dmitry                                   Fri, 27 Aug 2010 08:50:32 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=302845

Log:
Don't check FCGI_WEB_SERVER_ADDRS for UNIX sockets

Changed paths:
    U   php/php-src/trunk/sapi/cgi/fastcgi.c

Modified: php/php-src/trunk/sapi/cgi/fastcgi.c
===================================================================
--- php/php-src/trunk/sapi/cgi/fastcgi.c        2010-08-27 08:49:21 UTC (rev 
302844)
+++ php/php-src/trunk/sapi/cgi/fastcgi.c        2010-08-27 08:50:32 UTC (rev 
302845)
@@ -1157,17 +1157,19 @@
                                        FCGI_LOCK(req->listen_socket);
                                        req->fd = accept(listen_socket, (struct 
sockaddr *)&sa, &len);
                                        FCGI_UNLOCK(req->listen_socket);
-                                       if (req->fd >= 0 && allowed_clients) {
+                                       if (req->fd >= 0 &&
+                                           allowed_clients &&
+                                           ((struct sockaddr *)&sa)->sa_family 
== AF_INET) {
                                                int n = 0;
                                                int allowed = 0;

-                                                       while 
(allowed_clients[n] != INADDR_NONE) {
-                                                               if 
(allowed_clients[n] == sa.sa_inet.sin_addr.s_addr) {
-                                                                       allowed 
= 1;
-                                                                       break;
-                                                               }
-                                                               n++;
+                                               while (allowed_clients[n] != 
INADDR_NONE) {
+                                                       if (allowed_clients[n] 
== sa.sa_inet.sin_addr.s_addr) {
+                                                               allowed = 1;
+                                                               break;
                                                        }
+                                                       n++;
+                                               }
                                                if (!allowed) {
                                                        fprintf(stderr, 
"Connection from disallowed IP address '%s' is dropped.\n", 
inet_ntoa(sa.sa_inet.sin_addr));
                                                        closesocket(req->fd);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to