summaryrefslogtreecommitdiff
path: root/main/streams/plain_wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/streams/plain_wrapper.c')
-rw-r--r--main/streams/plain_wrapper.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 23b9ccbb86..0f1d8375c1 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -859,10 +859,6 @@ static php_stream *php_plain_files_dir_opener(php_stream_wrapper *wrapper, char
return NULL;
}
- if (PG(safe_mode) &&(!php_checkuid(path, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- return NULL;
- }
-
dir = VCWD_OPENDIR(path);
#ifdef PHP_WIN32
@@ -992,13 +988,6 @@ static php_stream *php_plain_files_stream_opener(php_stream_wrapper *wrapper, ch
return NULL;
}
- if ((php_check_safe_mode_include_dir(path TSRMLS_CC)) == 0) {
- return php_stream_fopen_rel(path, mode, opened_path, options);
- }
-
- if ((options & ENFORCE_SAFE_MODE) && PG(safe_mode) && (!php_checkuid(path, mode, CHECKUID_CHECK_MODE_PARAM)))
- return NULL;
-
return php_stream_fopen_rel(path, mode, opened_path, options);
}
@@ -1009,10 +998,6 @@ static int php_plain_files_url_stater(php_stream_wrapper *wrapper, char *url, in
url += sizeof("file://") - 1;
}
- if (PG(safe_mode) &&(!php_checkuid_ex(url, NULL, CHECKUID_CHECK_FILE_AND_DIR, (flags & PHP_STREAM_URL_STAT_QUIET) ? CHECKUID_NO_ERRORS : 0))) {
- return -1;
- }
-
if (php_check_open_basedir_ex(url, (flags & PHP_STREAM_URL_STAT_QUIET) ? 0 : 1 TSRMLS_CC)) {
return -1;
}
@@ -1034,16 +1019,6 @@ static int php_plain_files_unlink(php_stream_wrapper *wrapper, char *url, int op
url = p + 3;
}
- 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;
- }
- }
-
ret = VCWD_UNLINK(url);
if (ret == -1) {
if (options & REPORT_ERRORS) {
@@ -1086,11 +1061,6 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, char *url_from, c
url_to = p + 3;
}
- if (PG(safe_mode) && (!php_checkuid(url_from, NULL, CHECKUID_CHECK_FILE_AND_DIR) ||
- !php_checkuid(url_to, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- return 0;
- }
-
if (php_check_open_basedir(url_from TSRMLS_CC) || php_check_open_basedir(url_to TSRMLS_CC)) {
return 0;
}
@@ -1246,10 +1216,6 @@ static int php_plain_files_rmdir(php_stream_wrapper *wrapper, char *url, int opt
#if PHP_WIN32
int url_len = strlen(url);
#endif
- 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;
}
@@ -1298,7 +1264,6 @@ PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char
char *pathbuf, *ptr, *end;
char *exec_fname;
char trypath[MAXPATHLEN];
- struct stat sb;
php_stream *stream;
int path_length;
int filename_length;
@@ -1330,17 +1295,9 @@ PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char
return NULL;
}
- if (PG(safe_mode) && (!php_checkuid(filename, mode, CHECKUID_CHECK_MODE_PARAM))) {
- return NULL;
- }
return php_stream_fopen_rel(filename, mode, opened_path, options);
}
- /*
- * files in safe_mode_include_dir (or subdir) are excluded from
- * safe mode GID/UID checks
- */
-
not_relative_path:
/* Absolute path open */
@@ -1350,13 +1307,6 @@ not_relative_path:
return NULL;
}
- if ((php_check_safe_mode_include_dir(filename TSRMLS_CC)) == 0)
- /* filename is in safe_mode_include_dir (or subdir) */
- return php_stream_fopen_rel(filename, mode, opened_path, options);
-
- if (PG(safe_mode) && (!php_checkuid(filename, mode, CHECKUID_CHECK_MODE_PARAM)))
- return NULL;
-
return php_stream_fopen_rel(filename, mode, opened_path, options);
}
@@ -1377,21 +1327,12 @@ not_relative_path:
if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(trypath TSRMLS_CC)) {
return NULL;
}
- if ((php_check_safe_mode_include_dir(trypath TSRMLS_CC)) == 0) {
- return php_stream_fopen_rel(trypath, mode, opened_path, options);
- }
- if (PG(safe_mode) && (!php_checkuid(trypath, mode, CHECKUID_CHECK_MODE_PARAM))) {
- return NULL;
- }
return php_stream_fopen_rel(trypath, mode, opened_path, options);
}
#endif
if (!path || (path && !*path)) {
- if (PG(safe_mode) && (!php_checkuid(filename, mode, CHECKUID_CHECK_MODE_PARAM))) {
- return NULL;
- }
return php_stream_fopen_rel(filename, mode, opened_path, options);
}
@@ -1439,21 +1380,8 @@ not_relative_path:
goto stream_skip;
}
- if (PG(safe_mode)) {
- if (VCWD_STAT(trypath, &sb) == 0) {
- /* file exists ... check permission */
- if ((php_check_safe_mode_include_dir(trypath TSRMLS_CC) == 0) ||
- php_checkuid_ex(trypath, mode, CHECKUID_CHECK_MODE_PARAM, CHECKUID_NO_ERRORS)) {
- /* UID ok, or trypath is in safe_mode_include_dir */
- stream = php_stream_fopen_rel(trypath, mode, opened_path, options);
- goto stream_done;
- }
- }
- goto stream_skip;
- }
stream = php_stream_fopen_rel(trypath, mode, opened_path, options);
if (stream) {
-stream_done:
efree(pathbuf);
return stream;
}