summaryrefslogtreecommitdiff
path: root/main/fopen_wrappers.h
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2009-01-16 10:06:10 +0000
committerPierre Joye <pajoye@php.net>2009-01-16 10:06:10 +0000
commit8dfe43815efe0d6f887715881d0e3bfee7704778 (patch)
tree744b8f534ce9a2298b16febd8bbbfb45a2295023 /main/fopen_wrappers.h
parent59b6e456cb4fedcb2fb72c098689a8f77a30b2f6 (diff)
downloadphp-git-8dfe43815efe0d6f887715881d0e3bfee7704778.tar.gz
- MFH: add OPENBASEDIR_CHECKPATH macro to ease merge between 5.3 and 6, it includes safemode (5.3) and openbasedir check
Diffstat (limited to 'main/fopen_wrappers.h')
-rw-r--r--main/fopen_wrappers.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h
index 92e7380338..b746a3c7e0 100644
--- a/main/fopen_wrappers.h
+++ b/main/fopen_wrappers.h
@@ -33,6 +33,16 @@ 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);
PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path TSRMLS_DC);
+/* {{{ OPENBASEDIR_CHECKPATH(filename) to ease merge between 6.x and 5.x */
+#if (PHP_MAJOR_VERSION < 6)
+# define OPENBASEDIR_CHECKPATH(filename) \
+ (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename TSRMLS_CC)
+#else
+#define OPENBASEDIR_CHECKPATH(filename) \
+ php_check_open_basedir(filename TSRMLS_CC)
+#endif
+/* }}} */
+
PHPAPI int php_check_safe_mode_include_dir(const char *path TSRMLS_DC);
PHPAPI char *php_resolve_path(const char *filename, int filename_len, const char *path TSRMLS_DC);