cvs: php4 /ext/standard link.c
| From: | Stefan Esser | Date: | Sun, 16 Jun 2002 21:24:15 +0000 |
| Subject: | cvs: php4 /ext/standard link.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-12383@lists.php.net to get a copy of this message | ||
sesser Sun Jun 16 17:24:15 2002 EDT
Modified files:
/php4/ext/standard link.c
Log:
Fixed Bug #17790
- link and symlink now check uid and open_base_dir for link and its target
Index: php4/ext/standard/link.c
diff -u php4/ext/standard/link.c:1.37 php4/ext/standard/link.c:1.38
--- php4/ext/standard/link.c:1.37 Thu Feb 28 03:26:46 2002
+++ php4/ext/standard/link.c Sun Jun 16 17:24:15 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: link.c,v 1.37 2002/02/28 08:26:46 sebastian Exp $ */
+/* $Id: link.c,v 1.38 2002/06/16 21:24:15 sesser Exp $ */
#include "php.h"
#include "php_filestat.h"
@@ -114,6 +114,18 @@
RETURN_FALSE;
}
+ if (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(frompath), NULL,
CHECKUID_CHECK_FILE_AND_DIR)) {
+ RETURN_FALSE;
+ }
+
+ if (php_check_open_basedir(Z_STRVAL_PP(topath) TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+
+ if (php_check_open_basedir(Z_STRVAL_PP(frompath) TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+
if (!strncasecmp(Z_STRVAL_PP(topath), "http://", 7) ||
!strncasecmp(Z_STRVAL_PP(topath), "ftp://", 6)) {
php_error(E_WARNING, "Unable to symlink to a URL");
RETURN_FALSE;
@@ -143,6 +155,18 @@
convert_to_string_ex(frompath);
if (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(topath), NULL,
CHECKUID_CHECK_FILE_AND_DIR)) {
+ RETURN_FALSE;
+ }
+
+ if (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(frompath), NULL,
CHECKUID_CHECK_FILE_AND_DIR)) {
+ RETURN_FALSE;
+ }
+
+ if (php_check_open_basedir(Z_STRVAL_PP(topath) TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+
+ if (php_check_open_basedir(Z_STRVAL_PP(frompath) TSRMLS_CC)) {
RETURN_FALSE;
}