X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=missing.h;h=de4f0831163e92ef20d115991225dfec945c6d68;hp=5a1fc48c6c3617c6ed708b9b8ad770613ae275cd;hb=ad5f896b03adaa073134a00108a9cdf00720673a;hpb=34c551d43ab4fbfff88a81e545a43fbbf7a8a75d diff --git a/missing.h b/missing.h index 5a1fc48..de4f083 100644 --- a/missing.h +++ b/missing.h @@ -17,6 +17,49 @@ #include "php_version.h" +#if defined(PHP_VERSION_ID) && (PHP_VERSION_ID >= 50399) +# define ZEND_LITERAL_KEY_DC , const zend_literal *_zend_literal_key +# define ZEND_LITERAL_KEY_CC , _zend_literal_key +# define ZEND_LITERAL_NIL_CC , NULL +# define HTTP_CHECK_OPEN_BASEDIR(file, act) \ + if ((PG(open_basedir) && *PG(open_basedir))) \ + { \ + const char *tmp = file; \ + \ + if (!strncasecmp(tmp, "file:", lenof("file:"))) { \ + tmp += lenof("file:"); \ + while ((tmp - (const char *)file < 7) && (*tmp == '/' || *tmp == '\\')) ++tmp; \ + } \ + \ + if ( (tmp != file || !strstr(file, "://")) && \ + (!*tmp || php_check_open_basedir(tmp TSRMLS_CC))) { \ + act; \ + } \ + } + +#else +# define ZEND_LITERAL_KEY_DC +# define ZEND_LITERAL_KEY_CC +# define ZEND_LITERAL_NIL_CC +# define HTTP_CHECK_OPEN_BASEDIR(file, act) \ + if ((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) \ + { \ + const char *tmp = file; \ + \ + if (!strncasecmp(tmp, "file:", lenof("file:"))) { \ + tmp += lenof("file:"); \ + while ((tmp - (const char *)file < 7) && (*tmp == '/' || *tmp == '\\')) ++tmp; \ + } \ + \ + 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; \ + } \ + } + +#endif + #if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION >= 3) # define HTTP_ZAPI_HASH_TSRMLS_CC TSRMLS_CC # define HTTP_ZAPI_HASH_TSRMLS_DC TSRMLS_DC