From e74004236363e74f1ecef85df9e5812d93a17998 Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Sun, 17 Sep 2000 05:52:26 +0000 Subject: [PATCH] - Fix doc_root problem. If you need to limit under which directories the scripts should reside use open_basedir. --- main/fopen_wrappers.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) 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; -- 2.50.1