X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_api.h;h=3d708d7ba396c82e4385ecbf49ef214e9d0fcf76;hp=694ddc015de9fdfb1b26c8f1bcf1312e51c2f337;hb=32e91737086db53bb1fd9ed9f79d693c43ec459f;hpb=14819be2113881e1030d23c6a1a32e17083ab406 diff --git a/php_http_api.h b/php_http_api.h index 694ddc0..3d708d7 100644 --- a/php_http_api.h +++ b/php_http_api.h @@ -6,7 +6,7 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2004-2005, Michael Wallner | + | Copyright (c) 2004-2006, Michael Wallner | +--------------------------------------------------------------------+ */ @@ -89,12 +89,12 @@ extern void _http_error_ex(long type TSRMLS_DC, long code, const char *format, . \ if (!strncasecmp(tmp, "file:", lenof("file:"))) { \ tmp += lenof("file:"); \ - while (*tmp == '/' || *tmp == '\\') ++tmp; \ + while ((tmp - (const char *)file < 7) && (*tmp == '/' || *tmp == '\\')) ++tmp; \ } \ \ - if (!*tmp || php_check_open_basedir(tmp TSRMLS_CC) || \ - (PG(safe_mode) && !php_checkuid(tmp, "rb+", CHECKUID_CHECK_MODE_PARAM))) { \ - http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Permission denied: %s", file); \ + if ( (tmp != file || !strstr(file, "://")) && \ + (!*tmp || php_check_open_basedir(tmp TSRMLS_CC) || \ + (PG(safe_mode) && !php_checkuid(tmp, "rb+", CHECKUID_CHECK_MODE_PARAM)))) { \ act; \ } \ } @@ -192,6 +192,29 @@ static inline zval *_convert_to_type_ex(int type, zval *z, zval **p) return z; } +#define zval_copy(t, z) _zval_copy((t), (z) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) +static inline zval *_zval_copy(int type, zval *z ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) +{ + zval *copy; + + copy = emalloc_rel(sizeof(zval)); + *copy = *z; + zval_copy_ctor(copy); + convert_to_type(type, copy); + copy->refcount = 0; + copy->is_ref = 0; + + return copy; +} + +#define zval_free(z) _zval_free(z) +static inline void _zval_free(zval **z) +{ + zval_dtor(*z); + FREE_ZVAL(*z); + *z = NULL; +} + #endif /*