Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32643 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57025 invoked by uid 1010); 5 Oct 2007 07:09:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 57009 invoked from network); 5 Oct 2007 07:09:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Oct 2007 07:09:48 -0000 Authentication-Results: pb1.pair.com header.from=ab5602@wayne.edu; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ab5602@wayne.edu; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain wayne.edu from 141.217.1.231 cause and error) X-PHP-List-Original-Sender: ab5602@wayne.edu X-Host-Fingerprint: 141.217.1.231 mirapointmr2.wayne.edu Received: from [141.217.1.231] ([141.217.1.231:19585] helo=mirapointmr2.wayne.edu) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E9/74-25026-B33E5074 for ; Fri, 05 Oct 2007 03:09:47 -0400 Received: from ab5602-home.local (ab5602.cc.wayne.edu [141.217.4.107]) by mirapointmr2.wayne.edu (MOS 3.8.5-GA) with ESMTP id EFC20950; Fri, 5 Oct 2007 03:09:44 -0400 (EDT) Message-ID: <4705E338.4020707@wayne.edu> Date: Fri, 05 Oct 2007 03:09:44 -0400 Organization: Wayne State University User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: internals@lists.php.net X-Enigmail-Version: 0.95.3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Junkmail-Status: score=10/60, host=mirapointmr2.wayne.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090202.4705E338.0138,ss=1,fgs=0, ip=141.217.4.107, so=2007-07-31 18:51:00, dmn=5.4.3/2007-09-06 Subject: Patch for bug# 41822 From: ab5602@wayne.edu (Rob Thompson) Here is a patch for bug 41822. The expand_filepath() function will not work in Solaris if a non-root user attempts to read a file under a directory with only (--x) permissions. Currently expand_path() returns NULL and no FD is opened, although the file is readable. This patch adds a last-ditch effort to open includes using a relative path and returns NULL if it still can't get a file descriptor. expand_filepath() returns NULL in solaris because getcwd() returns NULL under the above conditions. Thanks, -Rob --- ./plain_wrapper.c.old 2007-10-05 02:50:59.000000000 -0400 +++ ./plain_wrapper.c 2007-10-05 02:55:38.000000000 -0400 @@ -885,9 +885,20 @@ return NULL; } - if ((realpath = expand_filepath(filename, NULL TSRMLS_CC)) == NULL) { - return NULL; - } + if ((realpath = expand_filepath(filename, NULL TSRMLS_CC)) == NULL) + { + if (options & STREAM_OPEN_FOR_INCLUDE) { + /* Attempt to open without path expansion anyways. + Files in Solaris dirs with --x will + not return a realpath, but are accessible */ + fd = open(filename, open_flags, 0666); + if (fd != -1) { + ret = php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id); + return ret; } + else { + return NULL; } + } + } if (persistent) { spprintf(&persistent_id, 0, "streams_stdio_%d_%s", open_flags, realpath);