cvs: php4 /main safe_mode.c
| From: | Stefan Esser | Date: | Sun, 17 Mar 2002 21:00:45 +0000 |
| Subject: | cvs: php4 /main safe_mode.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-10304@lists.php.net to get a copy of this message | ||
sesser Sun Mar 17 16:00:45 2002 EDT
Modified files:
/php4/main safe_mode.c
Log:
SAFE_MODE restriction error message fixed if the file doesn't exist
Index: php4/main/safe_mode.c
diff -u php4/main/safe_mode.c:1.43 php4/main/safe_mode.c:1.44
--- php4/main/safe_mode.c:1.43 Thu Mar 14 11:48:18 2002
+++ php4/main/safe_mode.c Sun Mar 17 16:00:44 2002
@@ -15,7 +15,7 @@
| Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: safe_mode.c,v 1.43 2002/03/14 16:48:18 sesser Exp $ */
+/* $Id: safe_mode.c,v 1.44 2002/03/17 21:00:44 sesser Exp $ */
#include "php.h"
@@ -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 @@
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 @@
*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 {