cvs: php-src /ext/standard filestat.c

From: Date: Sun, 09 Apr 2006 17:58:02 +0000
Subject: cvs: php-src /ext/standard filestat.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-37721@lists.php.net to get a copy of this message
iliaa Sun Apr 9 17:58:02 2006 UTC Modified files: /php-src/ext/standard filestat.c Log: MFB51: Fixed bug #36875 (is_*() functions do not account for open_basedir). http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/filestat.c?r1=1.144&r2=1.145&diff_format=u Index: php-src/ext/standard/filestat.c diff -u php-src/ext/standard/filestat.c:1.144 php-src/ext/standard/filestat.c:1.145 --- php-src/ext/standard/filestat.c:1.144 Sun Feb 19 18:19:33 2006 +++ php-src/ext/standard/filestat.c Sun Apr 9 17:58:02 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: filestat.c,v 1.144 2006/02/19 18:19:33 iliaa Exp $ */ +/* $Id: filestat.c,v 1.145 2006/04/09 17:58:02 iliaa Exp $ */ #include "php.h" #include "fopen_wrappers.h" @@ -584,15 +584,22 @@ int flags = 0, rmask=S_IROTH, wmask=S_IWOTH, xmask=S_IXOTH; /* access rights defaults to other */ char *stat_sb_names[13]={"dev", "ino", "mode", "nlink", "uid", "gid", "rdev", "size", "atime", "mtime", "ctime", "blksize", "blocks"}; + char *local; + php_stream_wrapper *wrapper; if (!filename_length) { RETURN_FALSE; } + if ((wrapper = php_stream_locate_url_wrapper(filename, &local, 0 TSRMLS_CC)) == &php_plain_files_wrapper) { + if (php_check_open_basedir(local TSRMLS_CC)) { + RETURN_FALSE; + } + } + if (IS_ACCESS_CHECK(type)) { - char *local; + if (wrapper == &php_plain_files_wrapper) { - if (php_stream_locate_url_wrapper(filename, &local, 0 TSRMLS_CC) == &php_plain_files_wrapper) { switch (type) { #ifdef F_OK case FS_EXISTS: @@ -672,9 +679,6 @@ if (IS_ABLE_CHECK(type) && getuid() == 0) { /* root has special perms on plain_wrapper But we don't know about root under Netware */ - php_stream_wrapper *wrapper; - - wrapper = php_stream_locate_url_wrapper(filename, NULL, 0 TSRMLS_CC); if (wrapper == &php_plain_files_wrapper) { if (type == FS_IS_X) { xmask = S_IXROOT;

« previous php.cvs (#37721) next »