summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2006-03-23 10:15:01 +0000
committerDmitry Stogov <dmitry@php.net>2006-03-23 10:15:01 +0000
commit0c1b4f45eb4a8116536aa5b44b3891b024f73e47 (patch)
treeef0ed4ab7d27bd167dc0c19ceaeb618f7d2c75d5
parentc4db88563f7288e01c1e31d3f6d66668f470c692 (diff)
downloadphp-git-0c1b4f45eb4a8116536aa5b44b3891b024f73e47.tar.gz
Allowed '-b' with UNIX sockets:
-b <hostname>:<port_number> -b <port_number> -b <unix_socket_path>
-rw-r--r--sapi/cgi/cgi_main.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 193506a346..c9e3317ee6 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -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);