php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #29574 [PATCH] FastCgi server can't be used with unix domain sockets
Submitted: 2004-08-08 19:56 UTC Modified: 2006-04-03 14:03 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: skettler@php.net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 5CVS, 4CVS (2005-07-12) OS: *nix
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: skettler@php.net
New email:
PHP Version: OS:

 

 [2004-08-08 19:56 UTC] skettler@php.net
Description:
------------
The cgi module does not accept unix domain sockets as parameters to option "-b", as it will be prefixed by ":".

This is needed so I don't have to revert to using iptables with owner matching to set access restrictions for local users; but use directory/file permissions.

Here's a patch against the latest CVS version to not prepend bindpath with ":" when it looks like a file:

Index: sapi/cgi/cgi_main.c
===================================================================
RCS file: /repository/php-src/sapi/cgi/cgi_main.c,v
retrieving revision 1.256
diff -u -r1.256 cgi_main.c
--- sapi/cgi/cgi_main.c 14 Jul 2004 22:30:27 -0000      1.256
+++ sapi/cgi/cgi_main.c 8 Aug 2004 14:53:57 -0000
@@ -1130,7 +1130,7 @@
                 * path (it's what the fastcgi library expects)
                 */

-               if (strchr(bindpath, ':') == NULL) {
+               if ((strchr(bindpath, ':') == NULL) && (strchr(bindpath, '/') == NULL)) {
                        char *tmp;

                        tmp = malloc(strlen(bindpath) + 2);


Reproduce code:
---------------
php -b /var/run/fastcgi/php4-someuser

Expected result:
----------------
Start a FastCgi server listening on "/var/run/fastcgi/php4-someuser".

Actual result:
--------------
No server starting as ":/var/run/fastcgi/php4-someuser" is passed to libfcgi.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-12 18:05 UTC] sniper@php.net
See also bug #33663 with another patch.

 [2006-04-03 14:03 UTC] tony2001@php.net
Dmitry has implemented this in 5.1 in different way.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Feb 26 09:01:26 2024 UTC