summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Esser <sesser@php.net>2002-03-17 21:00:44 +0000
committerStefan Esser <sesser@php.net>2002-03-17 21:00:44 +0000
commit0d3a45299da1a36dd54680221494917e7ae65597 (patch)
treeeebbf499fc3ae984542a074ce92e72841856605f
parentcce45de17c61bde089e7036ba4b3009a1f599a3b (diff)
downloadphp-git-0d3a45299da1a36dd54680221494917e7ae65597.tar.gz
SAFE_MODE restriction error message fixed if the file doesn't exist
-rw-r--r--main/safe_mode.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/main/safe_mode.c b/main/safe_mode.c
index f4f30d0e2f..d3ffab6a3f 100644
--- a/main/safe_mode.c
+++ b/main/safe_mode.c
@@ -46,7 +46,7 @@
PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode)
{
struct stat sb;
- int ret;
+ int ret, nofile=0;
long uid=0L, gid=0L, duid=0L, dgid=0L;
char path[MAXPATHLEN];
char *s;
@@ -86,6 +86,7 @@ PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode)
php_error(E_WARNING, "Unable to access %s", filename);
return 1;
}
+ nofile = 1;
} else {
uid = sb.st_uid;
gid = sb.st_gid;
@@ -150,6 +151,13 @@ PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode)
*s = 0;
}
}
+
+ if (nofile) {
+ uid = duid;
+ gid = dgid;
+ filename = path;
+ }
+
if (PG(safe_mode_gid)) {
php_error(E_WARNING, "SAFE MODE Restriction in effect. The script whose uid/gid is %ld/%ld is not allowed to access %s owned by uid/gid %ld/%ld", php_getuid(), php_getgid(), filename, uid, gid);
} else {