diff options
author | Wez Furlong <wez@php.net> | 2002-08-16 09:50:24 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2002-08-16 09:50:24 +0000 |
commit | c2cbae6dd3ace83f57e96c994d366f84f3c51bd0 (patch) | |
tree | 20dbb550ccb9f2390bf91097cf499a74e32cae58 /main/safe_mode.c | |
parent | 613871d403aca4210f92bec678f33788edd708f5 (diff) | |
download | php-git-c2cbae6dd3ace83f57e96c994d366f84f3c51bd0.tar.gz |
Enhance Ilia's recent patch to query the wrapper subsystem to determine
if a filename is a URL and thus if safe-mode checks should be skipped.
Diffstat (limited to 'main/safe_mode.c')
-rw-r--r-- | main/safe_mode.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/main/safe_mode.c b/main/safe_mode.c index a56094b33f..b56976ab44 100644 --- a/main/safe_mode.c +++ b/main/safe_mode.c @@ -52,6 +52,7 @@ PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode) long uid=0L, gid=0L, duid=0L, dgid=0L; char path[MAXPATHLEN]; char *s, filenamecopy[MAXPATHLEN]; + php_stream_wrapper *wrapper = NULL; TSRMLS_FETCH(); strlcpy(filenamecopy, filename, MAXPATHLEN); @@ -73,9 +74,9 @@ PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode) * If given filepath is a URL, allow - safe mode stuff * related to URL's is checked in individual functions */ - if (!strncasecmp(filename,"http://", 7) || !strncasecmp(filename,"ftp://", 6) || !strncasecmp(filename,"https://", 8)) { + wrapper = php_stream_locate_url_wrapper(filename, NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC); + if (wrapper != NULL) return 1; - } /* First we see if the file is owned by the same user... * If that fails, passthrough and check directory... |