wok view lighttpd/stuff/fastcgi_detach.patch @ rev 1095

lighttpd: fix fastcgi detach (Security alert)
author Christophe Lincoln <pankso@slitaz.org>
date Thu Jul 17 13:55:58 2008 +0200 (2008-07-17)
parents
children
line source
1 --- src/mod_fastcgi.c
2 +++ src/mod_fastcgi.c
3 +@@ -937,6 +937,24 @@
4 + close(fcgi_fd);
5 + }
6 +
7 + close(STDERR_FILENO);
8 + if(srv->errorlog_mode == ERRORLOG_FILE)
9 + dup2(srv->errorlog_fd, STDERR_FILENO);
10 + else {
11 + int fd = open("/dev/null", O_RDWR);
12 + dup2(fd, STDERR_FILENO);
13 + close(fd);
14 + }
15 +
16 + close(STDOUT_FILENO);
17 + if(srv->errorlog_mode == ERRORLOG_FILE)
18 + dup2(srv->errorlog_fd, STDOUT_FILENO);
19 + else {
20 + int fd = open("/dev/null", O_RDWR);
21 + dup2(fd, STDOUT_FILENO);
22 + close(fd);
23 + }
24 +
25 + /* we don't need the client socket */
26 + for (i = 3; i < 256; i++) {
27 + close(i);