]> granicus.if.org Git - php/commitdiff
Allowed '-b' with UNIX sockets:
authorDmitry Stogov <dmitry@php.net>
Thu, 23 Mar 2006 10:15:01 +0000 (10:15 +0000)
committerDmitry Stogov <dmitry@php.net>
Thu, 23 Mar 2006 10:15:01 +0000 (10:15 +0000)
  -b <hostname>:<port_number>
  -b <port_number>
  -b <unix_socket_path>

sapi/cgi/cgi_main.c

index 193506a3466b4933e5b75668ac5a2515212fba4c..c9e3317ee647a8e1fd03f930cacff91917a0d5b8 100644 (file)
@@ -921,6 +921,17 @@ void fastcgi_cleanup(int signal)
 }
 #endif
 
+static int is_port_number(const char *bindpath)
+{
+       while (*bindpath) {
+               if (*bindpath < '0' || *bindpath > '9') {
+                       return 0;
+               }
+               bindpath++;
+       }
+       return 1;
+}
+
 /* {{{ main
  */
 int main(int argc, char *argv[])
@@ -1147,7 +1158,7 @@ consult the installation file that came with this distribution, or visit \n\
                 * path (it's what the fastcgi library expects)
                 */
                
-               if (strchr(bindpath, ':') == NULL) {
+               if (strchr(bindpath, ':') == NULL && is_port_number(bindpath)) {
                        char *tmp;
 
                        tmp = malloc(strlen(bindpath) + 2);