- a stream wrapper that defeats the idea of streams is not really useful, so remove...
[m6w6/ext-http] / php_http_api.h
index c6d08d20b95088da63f584ffd5a817f4ee4bfe4f..9f8eda9537900929c8313eb28fc7b8e45a97a966 100644 (file)
@@ -82,6 +82,22 @@ extern void _http_error_ex(long type TSRMLS_DC, long code, const char *format, .
                action; \
        }
 
+#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; \
+               } \
+       }
 
 #define http_log(f, i, m) _http_log_ex((f), (i), (m) TSRMLS_CC)
 extern void http_log_ex(char *file, const char *ident, const char *message TSRMLS_DC);