]> granicus.if.org Git - php/commitdiff
MFH
authorIlia Alshanetsky <iliaa@php.net>
Sun, 17 Nov 2002 00:07:33 +0000 (00:07 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 17 Nov 2002 00:07:33 +0000 (00:07 +0000)
main/streams.c

index 5971d5c97108016fdb49fbb3dff25b179f30b0d3..e9ab2bf898542194495563fd1daca7aa128a8ac4 100755 (executable)
@@ -1590,6 +1590,32 @@ PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char
 
                return php_stream_fopen_rel(filename, mode, opened_path, options);
        }
+       
+#ifdef PHP_WIN32
+       if (IS_SLASH(filename[0])) {
+               int cwd_len;
+               char *cwd;
+               cwd = virtual_getcwd_ex(&cwd_len TSRMLS_CC);
+               /* getcwd() will return always return [DRIVE_LETTER]:/) on windows. */
+               *(cwd+3) = '\0';
+       
+               snprintf(trypath, MAXPATHLEN, "%s%s", cwd, filename);
+               
+               free(cwd);
+               
+               if (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)) {