Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36424 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17535 invoked from network); 24 Mar 2008 13:40:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Mar 2008 13:40:31 -0000 Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:40602] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 41/92-04656-A4FA7E74 for ; Mon, 24 Mar 2008 08:40:28 -0500 Received: from MBOERGER-ZRH.corp.google.com (84-210.0-85.cust.bluewin.ch [85.0.210.84]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 78BBE11F199; Mon, 24 Mar 2008 14:40:23 +0100 (CET) Date: Mon, 24 Mar 2008 14:39:52 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <119518366.20080324143952@marcus-boerger.de> To: Gregory Beaver CC: Dmitry Stogov , internals Mailing List , Stanislav Malyshev In-Reply-To: <47E7AC60.1040705@chiaraquartet.net> References: <47E2F8FA.20107@chiaraquartet.net> <47E37C42.10308@zend.com> <47E3E7F1.3060200@chiaraquartet.net> <47E792E1.9070803@zend.com> <47E7AC60.1040705@chiaraquartet.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] REMINDER - stream wrappers in include_path From: helly@php.net (Marcus Boerger) Hello Gregory, Monday, March 24, 2008, 2:28:00 PM, you wrote: > Index: main/fopen_wrappers.c > =================================================================== > RCS file: /repository/php-src/main/fopen_wrappers.c,v > retrieving revision 1.175.2.3.2.13.2.9 > diff -u -r1.175.2.3.2.13.2.9 fopen_wrappers.c > --- main/fopen_wrappers.c 24 Mar 2008 09:30:41 -0000 1.175.2.3.2.13.2.9 > +++ main/fopen_wrappers.c 24 Mar 2008 13:24:34 -0000 > @@ -473,7 +473,15 @@ > > ptr = path; > while (ptr && *ptr) { > - end = strchr(ptr, DEFAULT_DIR_SEPARATOR); > + /* Check for stream wrapper */ > + int is_stream_wrapper = 0; > + > + for (p = ptr; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++); > + if ((*p == ':') && (p - ptr > 1) && (p[1] == '/') && (p[2] == '/')) { However how about: if ((p > ptr) && !memcmp(p, "://", 3)) { > + p += 2; > + is_stream_wrapper = 1; > + } [...] > @@ -511,6 +538,29 @@ > exec_fname_length + 1 + filename_length + 1 < MAXPATHLEN) { > memcpy(trypath, exec_fname, exec_fname_length + 1); > memcpy(trypath+exec_fname_length + 1, filename, filename_length+1); > + > + /* Check for stream wrapper */ > + for (p = trypath; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++); > + if ((*p == ':') && (p - trypath > 1) && (p[1] == '/') && (p[2] == '/')) { Same as above > + char *actual; > Index: main/php_streams.h > =================================================================== > RCS file: /repository/php-src/main/php_streams.h,v > retrieving revision 1.103.2.1.2.4.2.2 > diff -u -r1.103.2.1.2.4.2.2 php_streams.h > --- main/php_streams.h 31 Dec 2007 07:17:17 -0000 1.103.2.1.2.4.2.2 > +++ main/php_streams.h 24 Mar 2008 13:24:34 -0000 > @@ -511,6 +511,12 @@ > /* don't check allow_url_fopen and allow_url_include */ > #define STREAM_DISABLE_URL_PROTECTION 0x00002000 > > +/* assume the path passed in exists and is fully expanded, avoiding syscalls */ > +#define ASSUME_REALPATH 0x00004000 > + > +/* assume the path passed in does not exist, and fail (plain wrapper only) */ > +#define REALPATH_FAILED 0x00008000 > + I think prefixinf with STREAMS_ would be good. > /* Antique - no longer has meaning */ > #define IGNORE_URL_WIN 0 > Best regards, Marcus