summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-06-24 13:56:25 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-06-24 13:56:25 +0000
commit6b5b6079da8af0e3b7d3bba2f26854ac8d05885d (patch)
treedb4071a4889aa8ef0350cbb3ee9963b965378379 /main
parenteea0ffc0d144667069c998ab85ca335112c62613 (diff)
downloadphp-git-6b5b6079da8af0e3b7d3bba2f26854ac8d05885d.tar.gz
Fix for bug #24313 (port from dead PHP_5 branch)
Diffstat (limited to 'main')
-rw-r--r--main/fopen_wrappers.c13
-rw-r--r--main/fopen_wrappers.h1
2 files changed, 11 insertions, 3 deletions
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index 714dc48bff..445e981b8f 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -162,9 +162,14 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path
}
/* }}} */
+PHPAPI int php_check_open_basedir(const char *path TSRMLS_DC)
+{
+ return php_check_open_basedir_ex(path, 1 TSRMLS_DC);
+}
+
/* {{{ php_check_open_basedir
*/
-PHPAPI int php_check_open_basedir(const char *path TSRMLS_DC)
+PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC)
{
/* Only check when open_basedir is available */
if (PG(open_basedir) && *PG(open_basedir)) {
@@ -190,8 +195,10 @@ PHPAPI int php_check_open_basedir(const char *path TSRMLS_DC)
ptr = end;
}
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s)", path, PG(open_basedir));
+ if (warn) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,
+ "open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s)", path, PG(open_basedir));
+ }
efree(pathbuf);
errno = EPERM; /* we deny permission to open it */
return -1;
diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h
index 7a3b9592e3..a15897e91e 100644
--- a/main/fopen_wrappers.h
+++ b/main/fopen_wrappers.h
@@ -28,6 +28,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC);
PHPAPI char *expand_filepath(const char *filepath, char *real_path TSRMLS_DC);
PHPAPI int php_check_open_basedir(const char *path TSRMLS_DC);
+PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC);
PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path TSRMLS_DC);
PHPAPI int php_check_safe_mode_include_dir(char *path TSRMLS_DC);