Bug #54726 [Com]: partial open_basedir path no longer works
| From: | superaap at gmail dot com | Date: | Sat, 21 May 2011 08:27:17 +0000 |
| Subject: | Bug #54726 [Com]: partial open_basedir path no longer works | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-160880@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54726&edit=1
ID: 54726
Comment by: superaap at gmail dot com
Reported by: superaap at gmail dot com
Summary: partial open_basedir path no longer works
Status: Duplicate
Type: Bug
Package: Safe Mode/open_basedir
Operating System: CentOS release 5.4 (Final)
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
Seems related to bug #53352 too, which was fixed in r305698
I'll try to build the latest snap and verify whether my problem was
fixed as well.
The patch looks promising.
Previous Comments:
------------------------------------------------------------------------
[2011-05-21 02:19:56] felipe@php.net
See bug #53577
------------------------------------------------------------------------
[2011-05-13 09:41:19] superaap at gmail dot com
Description:
------------
Our VirtualHost points to a symlink which links to the document_root of
the
current application version.
Example directory list;
l /var/www/html/application -> /var/www/html/application-v1.2.3
d /var/www/html/application-v1.2.2
d /var/www/html/application-v1.2.3
Before v5.3 (5.2.4 I think) using the entire symlink path as
open_basedir value
would sitll trigger
open_basedir error's. We worked around this problem by using the partial
suffix
'/var/www/html/app'.
This behaviour was fixed when we upgraded to v5.3.2 were the entire
symlink path
would work as well, but we
did not bother to update all our vhost's as both methods now worked.
But now we have upgraded to v5.3.6 the partial paths no longer work.
Warning: require_once() [function.require-once]: open_basedir
restriction in
effect.
File(/var/www/html/application-v1.2.3/bootstrap.php) is not within the
allowed
path(s): (.:/var/www/html/app)
This behaviour seems to be broken since r305698 where the open_basedir
is always
appended with a directory
separator;
--- php/php-src/trunk/main/fopen_wrappers.c 2010/11/23 21:49:18 305697
+++ php/php-src/trunk/main/fopen_wrappers.c 2010/11/23 22:14:54 305698
@@ -233,6 +233,9 @@
resolved_basedir[resolved_basedir_len] =
PHP_DIR_SEPARATOR;
resolved_basedir[++resolved_basedir_len] = '\0';
}
+ } else {
+ resolved_basedir[resolved_basedir_len++] =
PHP_DIR_SEPARATOR;
+ resolved_basedir[resolved_basedir_len] = '\0';
}
resolved_name_len = strlen(resolved_name);
I don't think this change was intended because it is not listed in the
changelog, and breaks backward
compatibility in a minor release.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54726&edit=1