summaryrefslogtreecommitdiff
path: root/main/streams/streams.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2007-07-03 10:22:55 +0000
committerDmitry Stogov <dmitry@php.net>2007-07-03 10:22:55 +0000
commitf766275b7a1485ad8ce327dbe51badc4157a3620 (patch)
tree81ed5033f154aefd876c8a957578ce3158044822 /main/streams/streams.c
parent070632248fdae2ecd7f728da3ef47313a7081b73 (diff)
downloadphp-git-f766275b7a1485ad8ce327dbe51badc4157a3620.tar.gz
Added ability to create local or remote (URL) user streams
Local user streams must not be able to open(), URLs if allow_url_include is off Implemented new function stream_is_local() [ - stream_wrapper_register() extended with additional optional argument "flags" of type long. This time only one flag is implemented - STREAM_IS_URL, that means that userstream wrapper is remote (URL). By default stream is local. - stream_is_local() is a new function that accepts stream and tell if this stream is local or remote (URL) ]
Diffstat (limited to 'main/streams/streams.c')
-rwxr-xr-xmain/streams/streams.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 24496d7c54..e484b7f9cb 100755
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -2163,8 +2163,9 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char
return plain_files_wrapper;
}
- if (!php_stream_allow_url_fopen(protocol, n) ||
- ((options & STREAM_OPEN_FOR_INCLUDE) && !php_stream_allow_url_include(protocol, n)) ) {
+ if (((options & STREAM_DISABLE_URL_PROTECTION) == 0) &&
+ (!php_stream_allow_url_fopen(protocol, n) ||
+ ((options & STREAM_OPEN_FOR_INCLUDE) && !php_stream_allow_url_include(protocol, n)))) {
if (options & REPORT_ERRORS) {
/* protocol[n] probably isn't '\0' */
char *protocol_dup = estrndup(protocol, n);
@@ -2797,7 +2798,7 @@ PHPAPI int _php_stream_path_encode(php_stream_wrapper *wrapper,
return FAILURE;
}
- wrapper = php_stream_locate_url_wrapper(scheme, NULL, options TSRMLS_CC);
+ wrapper = php_stream_locate_url_wrapper(scheme, NULL, options | STREAM_DISABLE_URL_PROTECTION TSRMLS_CC);
efree(scheme);
if (!wrapper) {
*pathenc = NULL;