From: Andi Gutmans Date: Sun, 17 Sep 2000 05:52:26 +0000 (+0000) Subject: - Fix doc_root problem. If you need to limit under which directories the X-Git-Tag: php-4.0.3RC1~122 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e74004236363e74f1ecef85df9e5812d93a17998;p=php - Fix doc_root problem. If you need to limit under which directories the scripts should reside use open_basedir. --- diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index e09e157c88..2e862db77e 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -397,27 +397,16 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char ** *opened_path = NULL; } - /* Relative path open */ - if (*filename == '.') { + filename_length = strlen(filename); + + /* Absolute & relative path open */ + if ((*filename == '.') || (IS_ABSOLUTE_PATH(filename, filename_length))) { if (PG(safe_mode) && (!php_checkuid(filename, mode, 0))) { return NULL; } return php_fopen_and_set_opened_path(filename, mode, opened_path); } - filename_length = strlen(filename); - /* Absolute path open - prepend document_root in safe mode */ - if (IS_ABSOLUTE_PATH(filename, filename_length)) { - if (PG(safe_mode) && PG(doc_root)) { - snprintf(trypath, MAXPATHLEN, "%s%s", PG(doc_root), filename); - if (!php_checkuid(trypath, mode, 0)) { - return NULL; - } - return php_fopen_and_set_opened_path(trypath, mode, opened_path); - } else { - return php_fopen_and_set_opened_path(filename, mode, opened_path); - } - } if (!path || (path && !*path)) { if (PG(safe_mode) && (!php_checkuid(filename, mode, 0))) { return NULL;