View | Details | Raw Unified | Return to bug 197844 | Differences between
and this patch

Collapse All | Expand All

(-)www/fcgi/Makefile (-2 / +3 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	fcgi
4
PORTNAME=	fcgi
5
PORTVERSION=	2.4.0
5
PORTVERSION=	2.4.0
6
PORTREVISION=	4
6
PORTREVISION=	5
7
CATEGORIES=	www
7
CATEGORIES=	www
8
MASTER_SITES=	http://www.fastcgi.com/dist/ \
8
MASTER_SITES=	http://www.fastcgi.com/dist/ \
9
		http://www.skysmurf.nl/comp/FreeBSD/distfiles/
9
		http://www.skysmurf.nl/comp/FreeBSD/distfiles/
Lines 17-26 Link Here
17
LICENSE_FILE=	${WRKSRC}/LICENSE.TERMS
17
LICENSE_FILE=	${WRKSRC}/LICENSE.TERMS
18
LICENSE_PERMS=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
18
LICENSE_PERMS=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
19
19
20
USES=		libtool
20
USES=		cpe libtool
21
GNU_CONFIGURE=	yes
21
GNU_CONFIGURE=	yes
22
USE_LDCONFIG=	yes
22
USE_LDCONFIG=	yes
23
MAKE_JOBS_UNSAFE=	yes
23
MAKE_JOBS_UNSAFE=	yes
24
CPE_VENDOR=	fastcgi
24
25
25
OPTIONS_DEFINE=	DOCS
26
OPTIONS_DEFINE=	DOCS
26
27
(-)www/fcgi/files/patch-CVE-2012-6687-pool (+81 lines)
Line 0 Link Here
1
diff --git a/libfcgi/os_unix.c b/libfcgi/os_unix.c
2
index 73e6a7f..af35aee 100755
3
--- libfcgi/os_unix.c
4
+++ libfcgi/os_unix.c
5
@@ -42,6 +42,7 @@ static const char rcsid[] = "$Id: os_unix.c,v 1.37 2002/03/05 19:14:49 robs Exp
6
 #include <sys/time.h>
7
 #include <sys/un.h>
8
 #include <signal.h>
9
+#include <poll.h>
10
 
11
 #ifdef HAVE_NETDB_H
12
 #include <netdb.h>
13
@@ -103,6 +104,9 @@ static int volatile maxFd = -1;
14
 static int shutdownPending = FALSE;
15
 static int shutdownNow = FALSE;
16
 
17
+static int libfcgiOsClosePollTimeout = 2000;
18
+static int libfcgiIsAfUnixKeeperPollTimeout = 2000;
19
+
20
 void OS_ShutdownPending()
21
 {
22
     shutdownPending = TRUE;
23
@@ -168,6 +172,16 @@ int OS_LibInit(int stdioFds[3])
24
     if(libInitialized)
25
         return 0;
26
 
27
+    char *libfcgiOsClosePollTimeoutStr = getenv( "LIBFCGI_OS_CLOSE_POLL_TIMEOUT" );
28
+    if(libfcgiOsClosePollTimeoutStr) {
29
+        libfcgiOsClosePollTimeout = atoi(libfcgiOsClosePollTimeoutStr);
30
+    }
31
+
32
+    char *libfcgiIsAfUnixKeeperPollTimeoutStr = getenv( "LIBFCGI_IS_AF_UNIX_KEEPER_POLL_TIMEOUT" );
33
+    if(libfcgiIsAfUnixKeeperPollTimeoutStr) {
34
+        libfcgiIsAfUnixKeeperPollTimeout = atoi(libfcgiIsAfUnixKeeperPollTimeoutStr);
35
+    }
36
+
37
     asyncIoTable = (AioInfo *)malloc(asyncIoTableSize * sizeof(AioInfo));
38
     if(asyncIoTable == NULL) {
39
         errno = ENOMEM;
40
@@ -755,19 +769,16 @@ int OS_Close(int fd)
41
 
42
     if (shutdown(fd, 1) == 0)
43
     {
44
-        struct timeval tv;
45
-        fd_set rfds;
46
+        struct pollfd pfd;
47
         int rv;
48
         char trash[1024];
49
 
50
-        FD_ZERO(&rfds);
51
+        pfd.fd = fd;
52
+        pfd.events = POLLIN;
53
 
54
         do 
55
         {
56
-            FD_SET(fd, &rfds);
57
-            tv.tv_sec = 2;
58
-            tv.tv_usec = 0;
59
-            rv = select(fd + 1, &rfds, NULL, NULL, &tv);
60
+            rv = poll(&pfd, 1, libfcgiOsClosePollTimeout);
61
         }
62
         while (rv > 0 && read(fd, trash, sizeof(trash)) > 0);
63
     }
64
@@ -1116,13 +1127,11 @@ static int is_reasonable_accept_errno (const int error)
65
  */
66
 static int is_af_unix_keeper(const int fd)
67
 {
68
-    struct timeval tval = { READABLE_UNIX_FD_DROP_DEAD_TIMEVAL };
69
-    fd_set read_fds;
70
-
71
-    FD_ZERO(&read_fds);
72
-    FD_SET(fd, &read_fds);
73
+    struct pollfd pfd;
74
+    pfd.fd = fd;
75
+    pfd.events = POLLIN;
76
 
77
-    return select(fd + 1, &read_fds, NULL, NULL, &tval) >= 0 && FD_ISSET(fd, &read_fds);
78
+    return poll(&pfd, 1, libfcgiIsAfUnixKeeperPollTimeout) >= 0 && (pfd.revents & POLLIN);
79
 }
80
 
81
 /*

Return to bug 197844