diff -Nru icecast2-2.4.0/debian/changelog icecast2-2.4.0/debian/changelog
--- icecast2-2.4.0/debian/changelog     2014-09-01 17:03:14.000000000 +0200
+++ icecast2-2.4.0/debian/changelog     2014-11-23 20:04:08.000000000 +0100
@@ -1,3 +1,11 @@
+icecast2 (2.4.0-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Include patchset 19313 (close file handles for external scripts).
+    (Closes: #770222)
+
+ -- Simon Richter <s...@debian.org>  Sun, 23 Nov 2014 20:02:58 +0100
+
 icecast2 (2.4.0-1) unstable; urgency=medium

   * Imported Upstream version 2.4.0
diff -Nru
icecast2-2.4.0/debian/patches/0001-disconnects_stdio_of_on_dis_connect_scripts_from_random_filehandles
icecast2-2.4.0/debian/patches/0001-disconnects_stdio_of_on_dis_connect_scripts_from_random_filehandles
---
icecast2-2.4.0/debian/patches/0001-disconnects_stdio_of_on_dis_connect_scripts_from_random_filehandles
     1970-01-01 01:00:00.000000000 +0100
+++
icecast2-2.4.0/debian/patches/0001-disconnects_stdio_of_on_dis_connect_scripts_from_random_filehandles
     2014-11-23 20:07:33.000000000 +0100
@@ -0,0 +1,80 @@
+Index: icecast2-2.4.0/src/source.c
+===================================================================
+--- icecast2-2.4.0.orig/src/source.c
++++ icecast2-2.4.0/src/source.c
+@@ -34,6 +34,12 @@
+ #define snprintf _snprintf
+ #endif
+
++#ifndef _WIN32
++/* for __setup_empty_script_environment() */
++#include <sys/stat.h>
++#include <fcntl.h>
++#endif
++
+ #include "thread/thread.h"
+ #include "avl/avl.h"
+ #include "httpp/httpp.h"
+@@ -1311,6 +1317,34 @@ void source_client_callback (client_t *c
+
+
+ #ifndef _WIN32
++/* this sets up the new environment for script execution.
++ * We ignore most failtures as we can not handle them anyway.
++ */
++static inline void __setup_empty_script_environment(void) {
++    int i;
++
++    /* close at least the first 1024 handles */
++    for (i = 0; i < 1024; i++)
++        close(i);
++
++    /* open null device */
++    i = open("/dev/null", O_RDWR);
++    if (i != -1) {
++        /* attach null device to stdin, stdout and stderr */
++        if (i != 0)
++            dup2(i, 0);
++        if (i != 1)
++            dup2(i, 1);
++        if (i != 2)
++            dup2(i, 2);
++
++        /* close null device */
++        if (i > 2)
++            close(i);
++    }
++}
++#endif
++
+ static void source_run_script (char *command, char *mountpoint)
+ {
+     pid_t pid, external_pid;
+@@ -1326,10 +1360,15 @@ static void source_run_script (char *com
+                     ERROR2 ("Unable to fork %s (%s)", command,
strerror (errno));
+                     break;
+                 case 0:  /* child */
++                    if (access(command, R_OK|X_OK) != 0) {
++                        ERROR2 ("Unable to run command %s (%s)",
command, strerror(errno));
++                        exit(1);
++                    }
+                     DEBUG1 ("Starting command %s", command);
+-                    execl (command, command, mountpoint, (char *)NULL);
+-                    ERROR2 ("Unable to run command %s (%s)", command,
strerror (errno));
+-                    exit(0);
++                    __setup_empty_script_environment();
++                    /* consider to add action here as well */
++                    execl(command, command, mountpoint, (char *)NULL);
++                    exit(1);
+                 default: /* parent */
+                     break;
+             }
+@@ -1342,8 +1381,6 @@ static void source_run_script (char *com
+             break;
+     }
+ }
+-#endif
+-
+
+ static void *source_fallback_file (void *arg)
+ {
diff -Nru icecast2-2.4.0/debian/patches/series
icecast2-2.4.0/debian/patches/series
--- icecast2-2.4.0/debian/patches/series        1970-01-01
01:00:00.000000000 +0100
+++ icecast2-2.4.0/debian/patches/series        2014-11-23
19:52:21.000000000 +0100
@@ -0,0 +1 @@
+0001-disconnects_stdio_of_on_dis_connect_scripts_from_random_filehandles

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
pkg-multimedia-maintainers mailing list
pkg-multimedia-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-multimedia-maintainers

Reply via email to