#25746 [Opn->Csd]: broken getcwd causes bailout and empty response body

From: Date: Thu, 09 Oct 2003 02:56:03 +0000
Subject: #25746 [Opn->Csd]: broken getcwd causes bailout and empty response body
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-48748@lists.php.net to get a copy of this message
 ID:               25746
 Updated by:       iliaa@php.net
 Reported By:      neilus at dcs dot kcl dot ac dot uk
-Status:           Open
+Status:           Closed
 Bug Type:         Apache related
 Operating System: Solaris
 PHP Version:      4.3.3
 New Comment:

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2003-10-03 11:49:21] neilus at dcs dot kcl dot ac dot uk

Description:
------------
The fix for bug #21310 introduced:
#if HAVE_BROKEN_GETCWD
                        /* this looks nasty to me */
                        old_cwd_fd = open(".", 0);
                        if (old_cwd_fd == -1) {
                                zend_bailout();
                        }

into php_execute_script in main/main.c.

If PHP does not have read permissions on the cwd, it bails out and the
client gets an empty response body.

This is a particular problem if the last request has chdir'd the web
server to such a directory. Apache does this when you request a file
that uses server side includes.

Reproduce code:
---------------
# mkdir -m 711 /tmp/abc
# cd /tmp/abc
# httpd -X
$ wget -q -O - http://localhost/content.php

# httpd -X
$ wget -q -O - http://localhost/no_read_perms/content.shtml
$ wget -q -O - http://localhost/content.php


Expected result:
----------------
$ wget -q -O - http://localhost/content.php
  ...
$

$ wget -q -O - http://localhost/no_read_perms/content.shtml
  ...
$ wget -q -O - http://localhost/content.php
  ...
$


Actual result:
--------------
$ wget -q -O - http://localhost/content.php
$

$ wget -q -O - http://localhost/no_read_perms/content.shtml
  ...
$ wget -q -O - http://localhost/content.php
$



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=25746&edit=1


Thread (2 messages)

« previous php.bugs (#48748) next »