lbarnaud Mon Aug 11 15:33:02 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src/main fopen_wrappers.c fopen_wrappers.h
Log:
MFH: Missing files in previous commit (Check the relevant path for
open_basedir
in symlink())
http://cvs.php.net/viewvc.cgi/php-src/main/fopen_wrappers.c?r1=1.175.2.3.2.13.2.12&r2=1.175.2.3.2.13.2.13&diff_format=u
Index: php-src/main/fopen_wrappers.c
diff -u php-src/main/fopen_wrappers.c:1.175.2.3.2.13.2.12
php-src/main/fopen_wrappers.c:1.175.2.3.2.13.2.13
--- php-src/main/fopen_wrappers.c:1.175.2.3.2.13.2.12 Mon Aug 4 07:20:15 2008
+++ php-src/main/fopen_wrappers.c Mon Aug 11 15:33:02 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fopen_wrappers.c,v 1.175.2.3.2.13.2.12 2008/08/04 07:20:15 dmitry Exp
$ */
+/* $Id: fopen_wrappers.c,v 1.175.2.3.2.13.2.13 2008/08/11 15:33:02 lbarnaud
Exp $ */
/* {{{ includes
*/
@@ -723,6 +723,14 @@
*/
PHPAPI char *expand_filepath(const char *filepath, char *real_path TSRMLS_DC)
{
+ return expand_filepath_ex(filepath, real_path, NULL, 0 TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ expand_filepath_ex
+ */
+PHPAPI char *expand_filepath_ex(const char *filepath, char *real_path, const
char *relative_to, size_t relative_to_len TSRMLS_DC)
+{
cwd_state new_state;
char cwd[MAXPATHLEN];
int copy_len;
@@ -733,7 +741,16 @@
cwd[0] = '\0';
} else {
const char *iam = SG(request_info).path_translated;
- char *result = VCWD_GETCWD(cwd, MAXPATHLEN);
+ const char *result;
+ if (relative_to) {
+ if (relative_to_len > MAXPATHLEN-1U) {
+ return NULL;
+ }
+ result = relative_to;
+ memcpy(cwd, relative_to, relative_to_len+1U);
+ } else {
+ result = VCWD_GETCWD(cwd, MAXPATHLEN);
+ }
if (!result && (iam != filepath)) {
int fdtest = -1;
http://cvs.php.net/viewvc.cgi/php-src/main/fopen_wrappers.h?r1=1.44.2.1.2.2.2.3&r2=1.44.2.1.2.2.2.4&diff_format=u
Index: php-src/main/fopen_wrappers.h
diff -u php-src/main/fopen_wrappers.h:1.44.2.1.2.2.2.3
php-src/main/fopen_wrappers.h:1.44.2.1.2.2.2.4
--- php-src/main/fopen_wrappers.h:1.44.2.1.2.2.2.3 Wed Mar 5 13:34:12 2008
+++ php-src/main/fopen_wrappers.h Mon Aug 11 15:33:02 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fopen_wrappers.h,v 1.44.2.1.2.2.2.3 2008/03/05 13:34:12 dmitry Exp $ */
+/* $Id: fopen_wrappers.h,v 1.44.2.1.2.2.2.4 2008/08/11 15:33:02 lbarnaud Exp $
*/
#ifndef FOPEN_WRAPPERS_H
#define FOPEN_WRAPPERS_H
@@ -26,6 +26,7 @@
PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC);
PHPAPI char *expand_filepath(const char *filepath, char *real_path TSRMLS_DC);
+PHPAPI char *expand_filepath_ex(const char *filepath, char *real_path, const
char *relative_to, size_t relative_to_len TSRMLS_DC);
PHPAPI int php_check_open_basedir(const char *path TSRMLS_DC);
PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php