sas             Wed Sep  3 04:15:10 2003 EDT

  Modified files:              
    /php-src/sapi/cgi   cgi_main.c 
  Log:
  fix heuristic: if someone passed "-b IP:port", this check would 
  falsely recognize the parameter as defining only a port.
  
  
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.240 php-src/sapi/cgi/cgi_main.c:1.241
--- php-src/sapi/cgi/cgi_main.c:1.240   Sun Aug 17 14:36:27 2003
+++ php-src/sapi/cgi/cgi_main.c Wed Sep  3 04:15:09 2003
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: cgi_main.c,v 1.240 2003/08/17 18:36:27 helly Exp $ */
+/* $Id: cgi_main.c,v 1.241 2003/09/03 08:15:09 sas Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -1111,7 +1111,6 @@
        /* for windows, socket listening is broken in the fastcgi library itself
           so dissabling this feature on windows till time is available to fix it */
        if (bindpath) {
-               int port = 0;
                /* this must be done to make FCGX_OpenSocket work correctly 
                   bug 23664 */
                close(0);
@@ -1119,11 +1118,16 @@
                 * If just a port is specified, then we prepend a ':' onto the
                 * path (it's what the fastcgi library expects)
                 */
-               port = atoi(bindpath);
-               if (port) {
-                       char bindport[32];
-                       snprintf(bindport, 32, ":%s", bindpath);
-                       fcgi_fd = FCGX_OpenSocket(bindport, 128);
+               
+               if (strchr(bindpath, ':') == NULL) {
+                       char *tmp;
+
+                       tmp = malloc(strlen(bindpath) + 2);
+                       tmp[0] = ':';
+                       memcpy(tmp + 1, bindpath, strlen(bindpath) + 1);
+
+                       fcgi_fd = FCGX_OpenSocket(tmp, 128);
+                       free(tmp);
                } else {
                        fcgi_fd = FCGX_OpenSocket(bindpath, 128);
                }

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

Reply via email to