|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-10-31 08:55 UTC] mbr at freebsd dot org
I've done this change in main/fopen_wrappers.c to see what happens: - php_error(E_WARNING, "open_basedir restriction - in effect. File is in wrong directory"); + php_error(E_WARNING, "open_basedir: File should + be in %s, but is in %s file (%s)", + pathbuf, path, + zend_get_executed_filename(TSRMLS_C)); let's say pathbuf=$a, path=$b, zend_get_executed_filename=$c As you see $a (which is PG(open_basedir)), should be identical to the path without added filename of both $b and $c. The error is random. Sometimes $a and $c are correct, and $b is plain wrong (from a previous request). Sometimes $a and $c are correct, and $b is wrong. [24-Oct-2002 10:49:19] PHP Warning: open_basedir: File should be in /www/doc/www.aaa.ch-80, but is in /www/doc/ www.bbb.ch-80/html/visions/php/include/globals.inc in /www/doc/www.aaa.ch-80/index.php on line 2 [24-Oct-2002 10:49:19] PHP Warning: open_basedir: File should be in /www/doc/www.aaa.ch-80, but is in /www/doc/ www.bbb.ch-80/html/visions/php//wrapper.php in /www/doc/www.aaa.ch-80/index.php on line 6 [24-Oct-2002 10:53:45] PHP Warning: open_basedir: File should be in /www/doc/www.aaa.ch-80, but is in /www/doc/ www.bbb.ch-80/html/visions/php//include/globals.inc in /www/doc/www.aaa.ch-80/index.php on line 2 [24-Oct-2002 10:53:45] PHP Warning: open_basedir: File should be in /www/doc/www.aaa.ch-80, but is in /www/doc/ www.bbb.ch-80/html/visions/php//wrapper.php in /www/doc/www.aaa.ch-80/index.php on line 6 This bug is critical and not fixed in cvs. I just tried the newest snapshot and it's not fixed. Martin PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 11:00:01 2025 UTC |
Previous dump was not the right one, sorry. I had dumps for children disabled. This is now the right one ... (gdb) bt #0 0x280de8e1 in strlen () from /usr/lib/libc.so.4 #1 0x17 in ?? () #2 0x2836decb in php_check_open_basedir (path=0x8c79c98 "/www/doc/www.skkonline.ch-80/top/scripts2/schools.php") at fopen_wrappers.c:211 #3 0x2836e19f in php_fopen_and_set_opened_path ( path=0x8c79c98 "/www/doc/www.skkonline.ch-80/top/scripts2/schools.php", mode=0x284e1ac3 "rb", opened_path=0xbfbff8d8) at fopen_wrappers.c:309 #4 0x2836e89d in php_fopen_with_path (filename=0x8c79c98 "/www/doc/www.skkonline.ch-80/top/scripts2/schools.php", mode=0x284e1ac3 "rb", path=0x81ebb50 ".", opened_path=0xbfbff8d8) at fopen_wrappers.c:494 #5 0x2836edc0 in php_fopen_url_wrapper (path=0x8c79c98 "/www/doc/www.skkonline.ch-80/top/scripts2/schools.php", mode=0x284e1ac3 "rb", options=1, issock=0xbfbfe6f0, socketd=0xbfbfe6ec, opened_path=0xbfbff8d8) at fopen_wrappers.c:612 #6 0x2836e26d in php_fopen_wrapper (path=0x8c79c98 "/www/doc/www.skkonline.ch-80/top/scripts2/schools.php", mode=0x284e1ac3 "rb", options=1, issock=0xbfbfe6f0, socketd=0xbfbfe6ec, opened_path=0xbfbff8d8) at fopen_wrappers.c:335 #7 0x2836b38c in php_fopen_wrapper_for_zend ( filename=0x8c79c98 "/www/doc/www.skkonline.ch-80/top/scripts2/schools.php", opened_path=0xbfbff8d8) at main.c:583 #8 0x28336463 in open_file_for_scanning (file_handle=0xbfbff8d0) at zend_language_scanner.c:2952 #9 0x28336611 in compile_file (file_handle=0xbfbff8d0, type=2) at zend_language_scanner.c:3009 #10 0x2835bb4f in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:823 #11 0x2836d0b9 in php_execute_script (primary_file=0xbfbff8d0) at main.c:1399 #12 0x28367d82 in apache_php_module_main (r=0x8c78038, display_source_mode=0) at sapi_apache.c:98 #13 0x28368c2c in send_php (r=0x8c78038, display_source_mode=0, filename=0x8c79c98 "/www/doc/www.skkonline.ch-80/top/scripts2/schools.php") at mod_php4.c:684 #14 0x28368c9f in send_parsed_php (r=0x8c78038) at mod_php4.c:703 (gdb) list 206 char *newpath; 207 char *ptr; 208 char *end; 209 210 pathbuf = estrdup(PG(open_basedir)); 211 newpath = estrdup(zend_get_executed_filename(TSRMLS_C)); 212 213 ptr = pathbuf; 214 while (ptr && *ptr) { 215 end = strchr(ptr, DEFAULT_DIR_SEPARATOR);My patch explained a bit more ... The main trick is that we do a stat() on $path: if (( stat (path, &statbuf)) < 0) { If the file does not exist, we can be sure that we triggered the bug and we let the check pass. As already said, this is only a workaround for the ugly bug ... Martin