Package: php4-cgi
Version: 4:4.3.10-15
Severity: important

(I have submitted this bug upstream also. See #33663 at bugs.php.net.)

I would like to start an instance of the FastCGI interpreter which
listens to a Unix Domain socket. libfcgi would this, but the wrapper
code in cgi_main.c differentiates only between

php4-cgi -b $ADDRESS:$PORT

and

php4-cgi -b [:]$PORT

If the colon is missing, it is assumed that the user wants a TCP socket
which is not bound to a specific address and thus a colon is prepended.
This breaks passing a path to a Unix Domain socket.

Fix: Since libfcgi apparently accepts the port only in numeric form
anyhow, I have simply added a check whether the first character of the
argument is a digit. In this case, it is assumed to be a port and
prepended with a colon. If not, it is assumed to be a pathname.
Alternatively, one could altogether remove the code which prepends the
colon and document the behavior.

Cheers,
-Hilko

diff -ui cgi_main.c.orig cgi_main.c
--- cgi_main.c.orig     2005-07-12 15:04:19.000000000 +0200
+++ cgi_main.c  2005-07-12 15:53:48.000000000 +0200
@@ -1140,12 +1140,12 @@
                /* this must be done to make FCGX_OpenSocket work correctly 
                   bug 23664 */
                close(0);
-               /* Pass on the arg to the FastCGI library, with one exception.
-                * If just a port is specified, then we prepend a ':' onto the
-                * path (it's what the fastcgi library expects)
+               /* Pass on the arg to the FastCGI library, with one exception. 
+                * If just a numeric port is specified, then we prepend a ':'
+                * onto the path (it's what the fastcgi library expects)
                 */
                
-               if (strchr(bindpath, ':') == NULL) {
+               if ( isdigit(bindpath[0]) && (strchr(bindpath, ':') == NULL) ) {
                        char *tmp;
 
                        tmp = malloc(strlen(bindpath) + 2);

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11-1-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages php4-cgi depends on:
ii  debconf [debconf-2.0]       1.4.52       Debian configuration management sy
ii  libbz2-1.0                  1.0.2-7      high-quality block-sorting file co
ii  libc6                       2.3.2.ds1-22 GNU C Library: Shared libraries an
ii  libcomerr2                  1.38-1       common error description library
ii  libdb4.2                    4.2.52-19    Berkeley v4.2 Database Libraries [
ii  libexpat1                   1.95.8-3     XML parsing C library - runtime li
ii  libkrb53                    1.3.6-3      MIT Kerberos runtime libraries
ii  libmagic1                   4.12-1       File type determination library us
ii  libpcre3                    5.0-1.1      Perl 5 Compatible Regular Expressi
ii  libssl0.9.7                 0.9.7g-1     SSL shared libraries
ii  libzzip-0-12                0.12.83-5    library providing read access on Z
ii  mime-support                3.34-1       MIME files 'mime.types' & 'mailcap
ii  php4-cli                    4:4.3.10-15  command-line interpreter for the p
ii  php4-common                 4:4.3.10-15  Common files for packages built fr
ii  zlib1g                      1:1.2.2-7    compression library - runtime

php4-cgi recommends no packages.

-- debconf information:
  php4/update_cgi_php_ini: true


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to