summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-02-02 23:43:17 (GMT)
committerIlia Alshanetsky <iliaa@php.net>2005-02-02 23:43:17 (GMT)
commite55938b6a83b32ba983627d7ebe95b87d18438ff (patch)
tree70f11806981074035b45b010e8a08c688fc4bbf0 /main
parent11339ee42eee8c86ec127d9e692074a0db60dec8 (diff)
downloadphp-e55938b6a83b32ba983627d7ebe95b87d18438ff.tar.gz
Fixed bug #31514 (open_basedir uses path_translated rather then cwd for .
translation).
Diffstat (limited to 'main')
-rw-r--r--main/fopen_wrappers.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index dc986ff..fc11b3c 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -96,24 +96,11 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path
char resolved_name[MAXPATHLEN];
char resolved_basedir[MAXPATHLEN];
char local_open_basedir[MAXPATHLEN];
- int local_open_basedir_pos;
int resolved_basedir_len;
int resolved_name_len;
/* Special case basedir==".": Use script-directory */
- if ((strcmp(basedir, ".") == 0) &&
- SG(request_info).path_translated &&
- *SG(request_info).path_translated
- ) {
- strlcpy(local_open_basedir, SG(request_info).path_translated, sizeof(local_open_basedir));
- local_open_basedir_pos = strlen(local_open_basedir) - 1;
-
- /* Strip filename */
- while (!IS_SLASH(local_open_basedir[local_open_basedir_pos])
- && (local_open_basedir_pos >= 0)) {
- local_open_basedir[local_open_basedir_pos--] = 0;
- }
- } else {
+ if (strcmp(basedir, ".") || !VCWD_GETCWD(local_open_basedir, MAXPATHLEN)) {
/* Else use the unmodified path */
strlcpy(local_open_basedir, basedir, sizeof(local_open_basedir));
}