cvs: php4 /main fopen_wrappers.c

From: Date: Fri, 04 Oct 2002 22:16:19 +0000
Subject: cvs: php4 /main fopen_wrappers.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-14557@lists.php.net to get a copy of this message
bfrance Fri Oct 4 18:16:19 2002 EDT Modified files: /php4/main fopen_wrappers.c Log: Fixed a problem where opendir with <path>/ and having <path>/ in open_basedir ini option didn't work. It was removing the trailing slashes and then addeding it back to only one of the string, now it adds it back to to both if needed. Index: php4/main/fopen_wrappers.c diff -u php4/main/fopen_wrappers.c:1.150 php4/main/fopen_wrappers.c:1.151 --- php4/main/fopen_wrappers.c:1.150 Sat Sep 28 12:27:10 2002 +++ php4/main/fopen_wrappers.c Fri Oct 4 18:16:16 2002 @@ -16,7 +16,7 @@ | Jim Winstead <jimw@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: fopen_wrappers.c,v 1.150 2002/09/28 16:27:10 rasmus Exp $ */ +/* $Id: fopen_wrappers.c,v 1.151 2002/10/04 22:16:16 bfrance Exp $ */ /* {{{ includes */ @@ -108,6 +108,7 @@ char local_open_basedir[MAXPATHLEN]; int local_open_basedir_pos; int resolved_basedir_len; + int resolved_name_len; /* Special case basedir==".": Use script-directory */ if ((strcmp(basedir, ".") == 0) && @@ -138,6 +139,12 @@ resolved_basedir_len = strlen(resolved_basedir); } + if (path[strlen(path)-1] == PHP_DIR_SEPARATOR) { + resolved_name_len = strlen(resolved_name); + resolved_name[resolved_name_len] = '/'; + resolved_name[++resolved_name_len] = '\0'; + } + /* Check the path */ #ifdef PHP_WIN32 if (strncasecmp(resolved_basedir, resolved_name, resolved_basedir_len) == 0) {

« previous php.cvs (#14557) next »