From: Pierre Joye Date: Fri, 16 Jan 2009 10:01:14 +0000 (+0000) Subject: - add OPENBASEDIR_CHECKPATH macro to ease merge between 5.3 and 6, it includes safemo... X-Git-Tag: php-5.4.0alpha1~191^2~4507 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=31b4e376d07c9aab368bbbb1685e9e40e04692c3;p=php - add OPENBASEDIR_CHECKPATH macro to ease merge between 5.3 and 6, it includes safemode (5.3) and openbasedir check --- diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h index e67f31ae6e..b746a3c7e0 100644 --- a/main/fopen_wrappers.h +++ b/main/fopen_wrappers.h @@ -33,6 +33,18 @@ 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); PHPAPI FILE *php_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path TSRMLS_DC);