cvs: php4 /main fopen-wrappers.c
| From: | Andi Gutmans | Date: | Sun, 17 Sep 2000 05:52:26 +0000 |
| Subject: | cvs: php4 /main fopen-wrappers.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1768@lists.php.net to get a copy of this message | ||
andi Sat Sep 16 22:52:26 2000 EDT
Modified files:
/php4/main fopen-wrappers.c
Log:
- Fix doc_root problem. If you need to limit under which directories the
scripts should reside use open_basedir.
Index: php4/main/fopen-wrappers.c
diff -u php4/main/fopen-wrappers.c:1.91 php4/main/fopen-wrappers.c:1.92
--- php4/main/fopen-wrappers.c:1.91 Thu Sep 14 13:47:35 2000
+++ php4/main/fopen-wrappers.c Sat Sep 16 22:52:26 2000
@@ -16,7 +16,7 @@
| Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: fopen-wrappers.c,v 1.91 2000/09/14 20:47:35 andi Exp $ */
+/* $Id: fopen-wrappers.c,v 1.92 2000/09/17 05:52:26 andi Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -397,27 +397,16 @@
*opened_path = NULL;
}
- /* Relative path open */
- if (*filename == '.') {
+ filename_length = strlen(filename);
+
+ /* Absolute & relative path open */
+ if ((*filename == '.') || (IS_ABSOLUTE_PATH(filename, filename_length))) {
if (PG(safe_mode) && (!php_checkuid(filename, mode, 0))) {
return NULL;
}
return php_fopen_and_set_opened_path(filename, mode, opened_path);
}
- filename_length = strlen(filename);
- /* Absolute path open - prepend document_root in safe mode */
- if (IS_ABSOLUTE_PATH(filename, filename_length)) {
- if (PG(safe_mode) && PG(doc_root)) {
- snprintf(trypath, MAXPATHLEN, "%s%s", PG(doc_root), filename);
- if (!php_checkuid(trypath, mode, 0)) {
- return NULL;
- }
- return php_fopen_and_set_opened_path(trypath, mode, opened_path);
- } else {
- return php_fopen_and_set_opened_path(filename, mode, opened_path);
- }
- }
if (!path || (path && !*path)) {
if (PG(safe_mode) && (!php_checkuid(filename, mode, 0))) {
return NULL;