iliaa Fri Oct 13 01:12:12 2006 UTC
Modified files: (Branch: PHP_4_4)
/php-src/main php_open_temporary_file.c
Log:
MFH: Improve open_basedir checks
http://cvs.php.net/viewvc.cgi/php-src/main/php_open_temporary_file.c?r1=1.18.2.10.2.5&r2=1.18.2.10.2.6&diff_format=u
Index: php-src/main/php_open_temporary_file.c
diff -u php-src/main/php_open_temporary_file.c:1.18.2.10.2.5
php-src/main/php_open_temporary_file.c:1.18.2.10.2.6
--- php-src/main/php_open_temporary_file.c:1.18.2.10.2.5 Thu Sep 28
08:26:45 2006
+++ php-src/main/php_open_temporary_file.c Fri Oct 13 01:12:11 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_open_temporary_file.c,v 1.18.2.10.2.5 2006/09/28 08:26:45 tony2001
Exp $ */
+/* $Id: php_open_temporary_file.c,v 1.18.2.10.2.6 2006/10/13 01:12:11 iliaa
Exp $ */
#include "php.h"
@@ -207,7 +207,7 @@
PHPAPI int php_open_temporary_fd(const char *dir, const char *pfx, char
**opened_path_p TSRMLS_DC)
{
int fd;
- const char *temp_dir = php_get_temporary_directory();
+ const char *temp_dir;
if (!pfx) {
pfx = "tmp.";
@@ -217,6 +217,9 @@
}
if (!dir || *dir == '\0') {
+def_tmp:
+ temp_dir = php_get_temporary_directory();
+
if (temp_dir && *temp_dir != '\0' &&
!php_check_open_basedir(temp_dir TSRMLS_CC)) {
return php_do_open_temporary_file(temp_dir, pfx,
opened_path_p TSRMLS_CC);
} else {
@@ -228,7 +231,7 @@
fd = php_do_open_temporary_file(dir, pfx, opened_path_p TSRMLS_CC);
if (fd == -1) {
/* Use default temporary directory. */
- fd = php_do_open_temporary_file(temp_dir, pfx, opened_path_p
TSRMLS_CC);
+ goto def_tmp;
}
return fd;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php