]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #31514 (open_basedir uses path_translated rather then cwd for .
authorIlia Alshanetsky <iliaa@php.net>
Wed, 2 Feb 2005 23:43:47 +0000 (23:43 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 2 Feb 2005 23:43:47 +0000 (23:43 +0000)
translation).

NEWS
main/fopen_wrappers.c

diff --git a/NEWS b/NEWS
index 993a3cc33d4e09872120cacca7ea23efde6568c1..4d5e256ee6bde951979f39be853ab788907afda9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,8 @@ PHP                                                                        NEWS
   (Marcus)
 - Fixed bug #31623 (OCILogin does not support password grace period).
   (daniel dot beet at accuratesoftware dot com, Tony)
+- Fixed bug #31514 (open_basedir uses path_translated rather then cwd for .
+  translation). (Ilia)
 - Fixed bug #31480 (Possible infinite loop in imap_mail_compose()). (Ilia)
 - Fixed bug #31479 (Fixed crash in chunk_split(), when chunklen > strlen). (Ilia)
 - Fixed bug #31465 (False warning in unpack() when working with *). (Ilia)
index d29a33b5b7c2aea77c0cb6c9342ec7c272c7ca70..d316f4ef1110c8c520cb40f87b52f2796430570d 100644 (file)
@@ -105,24 +105,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));
        }