stas Fri Aug 3 01:15:51 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/main main.c
Log:
make error_log setting access-controlled by safe_mode/open_basedir
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.51&r2=1.640.2.23.2.52&diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.640.2.23.2.51 php-src/main/main.c:1.640.2.23.2.52
--- php-src/main/main.c:1.640.2.23.2.51 Wed Aug 1 23:51:45 2007
+++ php-src/main/main.c Fri Aug 3 01:15:51 2007
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.640.2.23.2.51 2007/08/01 23:51:45 stas Exp $ */
+/* $Id: main.c,v 1.640.2.23.2.52 2007/08/03 01:15:51 stas Exp $ */
/* {{{ includes
*/
@@ -297,6 +297,27 @@
}
/* }}} */
+/* {{{ PHP_INI_MH
+ */
+static PHP_INI_MH(OnUpdateErrorLog)
+{
+ /* Only do the safemode/open_basedir check at runtime */
+ if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS)
&&
+ strcmp(PG(error_log), "syslog")) {
+ if (PG(safe_mode) && (!php_checkuid(new_value, NULL,
CHECKUID_CHECK_FILE_AND_DIR))) {
+ return FAILURE;
+ }
+
+ if (PG(open_basedir) && php_check_open_basedir(new_value
TSRMLS_CC)) {
+ return FAILURE;
+ }
+
+ }
+ OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2,
mh_arg3, stage TSRMLS_CC);
+ return SUCCESS;
+}
+/* }}} */
+
/* Need to convert to strings and make use of:
* PHP_SAFE_MODE
*
@@ -381,7 +402,7 @@
STD_PHP_INI_ENTRY("doc_root", NULL,
PHP_INI_SYSTEM, OnUpdateStringUnempty, doc_root,
php_core_globals, core_globals)
STD_PHP_INI_ENTRY("default_charset", SAPI_DEFAULT_CHARSET,
PHP_INI_ALL, OnUpdateString, default_charset,
sapi_globals_struct,sapi_globals)
STD_PHP_INI_ENTRY("default_mimetype", SAPI_DEFAULT_MIMETYPE,
PHP_INI_ALL, OnUpdateString, default_mimetype,
sapi_globals_struct,sapi_globals)
- STD_PHP_INI_ENTRY("error_log", NULL,
PHP_INI_ALL, OnUpdateString, error_log,
php_core_globals, core_globals)
+ STD_PHP_INI_ENTRY("error_log", NULL,
PHP_INI_ALL, OnUpdateErrorLog, error_log,
php_core_globals, core_globals)
STD_PHP_INI_ENTRY("extension_dir",
PHP_EXTENSION_DIR, PHP_INI_SYSTEM, OnUpdateStringUnempty,
extension_dir, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("include_path",
PHP_INCLUDE_PATH, PHP_INI_ALL, OnUpdateStringUnempty,
include_path, php_core_globals, core_globals)
PHP_INI_ENTRY("max_execution_time", "30",
PHP_INI_ALL, OnUpdateTimeout)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php