summaryrefslogtreecommitdiff
path: root/main/safe_mode.c
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2002-08-16 09:50:24 +0000
committerWez Furlong <wez@php.net>2002-08-16 09:50:24 +0000
commitc2cbae6dd3ace83f57e96c994d366f84f3c51bd0 (patch)
tree20dbb550ccb9f2390bf91097cf499a74e32cae58 /main/safe_mode.c
parent613871d403aca4210f92bec678f33788edd708f5 (diff)
downloadphp-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.c5
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...