cvs: php4 /ext/standard file.c /main php_streams.h /main/streams plain_wrapper.c

From: Date: Wed, 14 May 2003 15:12:07 +0000
Subject: cvs: php4 /ext/standard file.c /main php_streams.h /main/streams plain_wrapper.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-20900@lists.php.net to get a copy of this message
pollita Wed May 14 11:12:07 2003 EDT Modified files: /php4/ext/standard file.c /php4/main php_streams.h /php4/main/streams plain_wrapper.c Log: Fold 'options' parameter into wops->unlink method Index: php4/ext/standard/file.c diff -u php4/ext/standard/file.c:1.339 php4/ext/standard/file.c:1.340 --- php4/ext/standard/file.c:1.339 Wed May 14 04:27:48 2003 +++ php4/ext/standard/file.c Wed May 14 11:12:06 2003 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.339 2003/05/14 08:27:48 sas Exp $ */ +/* $Id: file.c,v 1.340 2003/05/14 15:12:06 pollita Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1434,7 +1434,7 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s does not allow unlinking", wrapper->wops->label ? wrapper->wops->label : "Wrapper"); RETURN_FALSE; } - RETURN_BOOL(wrapper->wops->unlink(wrapper, filename, context TSRMLS_CC)); + RETURN_BOOL(wrapper->wops->unlink(wrapper, filename, ENFORCE_SAFE_MODE | REPORT_ERRORS, context TSRMLS_CC)); } /* }}} */ Index: php4/main/php_streams.h diff -u php4/main/php_streams.h:1.79 php4/main/php_streams.h:1.80 --- php4/main/php_streams.h:1.79 Wed May 14 02:10:04 2003 +++ php4/main/php_streams.h Wed May 14 11:12:07 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_streams.h,v 1.79 2003/05/14 06:10:04 pollita Exp $ */ +/* $Id: php_streams.h,v 1.80 2003/05/14 15:12:07 pollita Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -147,7 +147,7 @@ const char *label; /* delete a file */ - int (*unlink)(php_stream_wrapper *wrapper, char *url, php_stream_context *context TSRMLS_DC); + int (*unlink)(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); } php_stream_wrapper_ops; struct _php_stream_wrapper { Index: php4/main/streams/plain_wrapper.c diff -u php4/main/streams/plain_wrapper.c:1.13 php4/main/streams/plain_wrapper.c:1.14 --- php4/main/streams/plain_wrapper.c:1.13 Wed May 14 02:10:04 2003 +++ php4/main/streams/plain_wrapper.c Wed May 14 11:12:07 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: plain_wrapper.c,v 1.13 2003/05/14 06:10:04 pollita Exp $ */ +/* $Id: plain_wrapper.c,v 1.14 2003/05/14 15:12:07 pollita Exp $ */ #include "php.h" #include "php_globals.h" @@ -889,7 +889,7 @@ return VCWD_STAT(url, &ssb->sb); } -static int php_plain_files_unlink(php_stream_wrapper *wrapper, char *url, php_stream_context *context TSRMLS_DC) +static int php_plain_files_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) { char *p; int ret; @@ -900,17 +900,21 @@ url = p + 3; } - if (PG(safe_mode) && !php_checkuid(url, NULL, CHECKUID_CHECK_FILE_AND_DIR)) { - return 0; - } + if (options & ENFORCE_SAFE_MODE) { + if (PG(safe_mode) && !php_checkuid(url, NULL, CHECKUID_CHECK_FILE_AND_DIR)) { + return 0; + } - if (php_check_open_basedir(url TSRMLS_CC)) { - return 0; + if (php_check_open_basedir(url TSRMLS_CC)) { + return 0; + } } ret = VCWD_UNLINK(url); if (ret == -1) { - php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "%s", strerror(errno)); + if (options & REPORT_ERRORS) { + php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "%s", strerror(errno)); + } return 0; } /* Clear stat cache */

« previous php.cvs (#20900) next »