Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:4622 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46238 invoked by uid 1010); 30 Sep 2003 18:21:26 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 46214 invoked from network); 30 Sep 2003 18:21:26 -0000 Received: from unknown (HELO mx.thebrainroom.net) (65.200.24.98) by pb1.pair.com with SMTP; 30 Sep 2003 18:21:26 -0000 Received: by mx.thebrainroom.net (Postfix, from userid 517) id CCA39148809D; Tue, 30 Sep 2003 11:20:23 -0700 (PDT) Received: from zaneeb.thebrainroom.net (unknown [82.133.1.138]) by mx.thebrainroom.net (Postfix) with ESMTP id A535A1488087; Tue, 30 Sep 2003 11:20:11 -0700 (PDT) Received: from titan (titan.thebrainroom.net [82.133.1.139]) by zaneeb.thebrainroom.net (8.11.6/8.11.6) with SMTP id h8UILD520167; Tue, 30 Sep 2003 19:21:13 +0100 Message-ID: <002701c3877f$a2369bb0$8b018552@titan> To: "Rob Richards" , Date: Tue, 30 Sep 2003 19:21:09 +0100 Organization: The Brain Room Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.3790.0 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 X-Spam-Status: No, hits=-0.5 required=5.0 tests=QUOTED_EMAIL_TEXT version=2.55 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) X-TBR-Filter: Virus scanned and defanged Subject: [PHP-DEV] filepaths, uris, safemode, etc.. From: wez@thebrainroom.com ("Wez Furlong") Sorry about the forwarding... had a little hiccup with my mail server... ----- Original Message ----- From: "Wez Furlong" To: "Rob Richards" ; Sent: Tuesday, September 30, 2003 7:10 PM Subject: Re: [PHP-DEV] filepaths, uris, safemode, etc.. > Hi Rob, > > The streams code, and also sqlite does this when checking for safemode for > local files: > > if (PG(safe_mode) && (!php_checkuid(path, NULL, > CHECKUID_CHECK_FILE_AND_DIR))) { > return SQLITE_DENY; > } > if (php_check_open_basedir(path TSRMLS_CC)) { > return SQLITE_DENY; > } > > You'll probably want to check if the path is a URI or local path first; the > streams code checks for :// to make this decision. > > If you're planning to tie streams into libxml, feel free to reuse the code I > added to pecl/soap: > http://cvs.php.net/diff.php/pecl/soap/php_xml.c?r1=1.5&r2=1.6&ty=u > http://cvs.php.net/diff.php/pecl/soap/soap.c?r1=1.15&r2=1.16&ty=u > > --Wez. > > > ----- Original Message ----- > From: "Rob Richards" > To: > Sent: Tuesday, September 30, 2003 12:52 PM > Subject: [PHP-DEV] filepaths, uris, safemode, etc.. > > > Within the dom extension, I am trying to resolve an issue with uris and > local filepaths which are passed to libxml. > When I get the filepath, I need to resolve any local filepaths to an > absoulte path. On top of this the safemode checks need to be done before > passing any of these to libxml. > > So far I started with taking the user supplied source string and running > that through the safemode checks. > If this passes, then the source is tested as follows: > > If uri, then it is passed to libxml, otherwise it gets passed through > expand_filepath and the resolved path is passed to libxml. > > It has been noted that file uris should not be passed in directly, but go > through the same path resolutions as local files and that the following > block of code be used instead of just using expand_filepath on all non uri > and file uri source strings: > #ifdef VIRTUAL_DIR > virtual_filepath_ex(source, &resolved_path, NULL TSRMLS_CC); > #else > resolved_path = source; > #endif > > My problem is that if VIRTUAL_DIR is not defined, then the resolved path > ends up being the origional source supplied, which means that relative paths > are not resolved. Also, should the path resolutions be done before the > safemode checks? > > On top of this I am looking at allowing additional registered streams to be > used, so not sure if that would change any of this. > > What is the correct way to implement this? > > Thanks, > > Rob > >