summaryrefslogtreecommitdiff
path: root/ext/zip
diff options
context:
space:
mode:
authorKalle Sommer Nielsen <kalle@php.net>2010-04-26 23:55:03 +0000
committerKalle Sommer Nielsen <kalle@php.net>2010-04-26 23:55:03 +0000
commitcb3033080017e05ae7843859f993517252e67e31 (patch)
tree675f409de0e4180a660cfe03df518c06aa18d847 /ext/zip
parent64f372fae2876a197996a1753d3659d8fa9d0bb4 (diff)
downloadphp-git-cb3033080017e05ae7843859f993517252e67e31.tar.gz
Merge safe_mode changes into extensions that are in sync in both branches
Diffstat (limited to 'ext/zip')
-rw-r--r--ext/zip/php_zip.c16
-rw-r--r--ext/zip/php_zip.h8
-rw-r--r--ext/zip/zip_stream.c4
3 files changed, 14 insertions, 14 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 6de4f629f6..cbfc0d938f 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -184,7 +184,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
php_basename(path_cleaned, path_cleaned_len, NULL, 0, &file_basename, (size_t *)&file_basename_len TSRMLS_CC);
- if (OPENBASEDIR_CHECKPATH(file_dirname_fullpath)) {
+ if (ZIP_OPENBASEDIR_CHECKPATH(file_dirname_fullpath)) {
efree(file_dirname_fullpath);
efree(file_basename);
free(new_state.cwd);
@@ -238,7 +238,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
* is required, does a file can have a different
* safemode status as its parent folder?
*/
- if (OPENBASEDIR_CHECKPATH(fullpath)) {
+ if (ZIP_OPENBASEDIR_CHECKPATH(fullpath)) {
efree(fullpath);
efree(file_dirname_fullpath);
efree(file_basename);
@@ -255,7 +255,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
return 0;
}
-#if (PHP_MAJOR_VERSION < 6)
+#if PHP_API_VERSION < 20100412
stream = php_stream_open_wrapper(fullpath, "w+b", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL);
#else
stream = php_stream_open_wrapper(fullpath, "w+b", REPORT_ERRORS, NULL);
@@ -288,7 +288,7 @@ static int php_zip_add_file(struct zip *za, const char *filename, int filename_l
char resolved_path[MAXPATHLEN];
- if (OPENBASEDIR_CHECKPATH(filename)) {
+ if (ZIP_OPENBASEDIR_CHECKPATH(filename)) {
return -1;
}
@@ -530,7 +530,7 @@ int php_zip_glob(char *pattern, int pattern_len, long flags, zval *return_value
/* we assume that any glob pattern will match files from one directory only
so checking the dirname of the first match should be sufficient */
strncpy(cwd, globbuf.gl_pathv[0], MAXPATHLEN);
- if (OPENBASEDIR_CHECKPATH(cwd)) {
+ if (ZIP_OPENBASEDIR_CHECKPATH(cwd)) {
return -1;
}
@@ -592,7 +592,7 @@ int php_zip_pcre(char *regexp, int regexp_len, char *path, int path_len, zval *r
}
#endif
- if (OPENBASEDIR_CHECKPATH(path)) {
+ if (ZIP_OPENBASEDIR_CHECKPATH(path)) {
return -1;
}
@@ -1148,7 +1148,7 @@ static PHP_NAMED_FUNCTION(zif_zip_open)
RETURN_FALSE;
}
- if (OPENBASEDIR_CHECKPATH(filename)) {
+ if (ZIP_OPENBASEDIR_CHECKPATH(filename)) {
RETURN_FALSE;
}
@@ -1437,7 +1437,7 @@ static ZIPARCHIVE_METHOD(open)
RETURN_FALSE;
}
- if (OPENBASEDIR_CHECKPATH(filename)) {
+ if (ZIP_OPENBASEDIR_CHECKPATH(filename)) {
RETURN_FALSE;
}
diff --git a/ext/zip/php_zip.h b/ext/zip/php_zip.h
index ac39a9ac85..1d5f9b358a 100644
--- a/ext/zip/php_zip.h
+++ b/ext/zip/php_zip.h
@@ -43,12 +43,12 @@ extern zend_module_entry zip_module_entry;
# endif
#endif
-/* {{{ OPENBASEDIR_CHECKPATH(filename) */
-#if (PHP_MAJOR_VERSION < 6)
-# define OPENBASEDIR_CHECKPATH(filename) \
+/* {{{ ZIP_OPENBASEDIR_CHECKPATH(filename) */
+#if PHP_API_VERSION < 20100412
+# define ZIP_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) \
+#define ZIP_OPENBASEDIR_CHECKPATH(filename) \
php_check_open_basedir(filename TSRMLS_CC)
#endif
/* }}} */
diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c
index bb676efb49..c535dd4f09 100644
--- a/ext/zip/zip_stream.c
+++ b/ext/zip/zip_stream.c
@@ -120,7 +120,7 @@ php_stream *php_stream_zip_open(char *filename, char *path, char *mode STREAMS_D
}
if (filename) {
- if (OPENBASEDIR_CHECKPATH(filename)) {
+ if (ZIP_OPENBASEDIR_CHECKPATH(filename)) {
return NULL;
}
@@ -201,7 +201,7 @@ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper,
php_basename(path, path_len - fragment_len, NULL, 0, &file_basename, &file_basename_len TSRMLS_CC);
fragment++;
- if (OPENBASEDIR_CHECKPATH(file_dirname)) {
+ if (ZIP_OPENBASEDIR_CHECKPATH(file_dirname)) {
efree(file_basename);
return NULL;
}