Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55646 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69697 invoked from network); 28 Sep 2011 08:46:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Sep 2011 08:46:48 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.42 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.218.42 mail-yi0-f42.google.com Received: from [209.85.218.42] ([209.85.218.42:57353] helo=mail-yi0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E4/31-62163-5FED28E4 for ; Wed, 28 Sep 2011 04:46:46 -0400 Received: by yib12 with SMTP id 12so7248401yib.29 for ; Wed, 28 Sep 2011 01:46:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=i/IvKJjzgSkezPQX9qC/9Y6eU41wwkif2KzTVJF7aSM=; b=ddVZlNdwpej29MBjzqTgbbJqfPJ4fX79AB+ah/K/aKqL4qM9GnsScXc//pV3UKkpFc N8ZPlHxN65FczE34W3q97mNPK+fC1o9Er8J3FJBSISrnEj9hNC0+8Ya1qcIKRdT7tgd8 dUF1k/NQtVsj+PYvNVzm972LvXB/OewuNKzN4= MIME-Version: 1.0 Received: by 10.146.2.5 with SMTP id 5mr1413933yab.27.1317199601993; Wed, 28 Sep 2011 01:46:41 -0700 (PDT) Received: by 10.147.169.18 with HTTP; Wed, 28 Sep 2011 01:46:41 -0700 (PDT) In-Reply-To: <4E82C679.9030800@thelounge.net> References: <4E81902E.1020304@thelounge.net> <4E824B36.4040209@gmail.com> <4E824BF7.9070405@thelounge.net> <4E824F69.1010703@gmail.com> <4E825084.4040703@thelounge.net> <4E82B825.5060003@daylessday.org> <4E82C679.9030800@thelounge.net> Date: Wed, 28 Sep 2011 10:46:41 +0200 Message-ID: To: Reindl Harald Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] open_basedir bypass -> errata tempnam() From: pierre.php@gmail.com (Pierre Joye) hi, On Wed, Sep 28, 2011 at 9:02 AM, Reindl Harald wrote: First, all you need to test is: $tempfile = tempnam($temp_folder, 'rhcsv'); $fp = fopen($tempfile , 'w'); > * /tmp MUST NOT be in open_basedir > * the temp-folder must be read only > * QUESTION1: why is tempnam() falling back to a dir outside open_basedir? > * QUESTION2: why is tempnam() creating a file OUTSIDE open_basedir? The flow can be easily seen here: http://lxr.php.net/opengrok/xref/PHP_5_4/ext/standard/file.c#798 http://lxr.php.net/xref/PHP_5_4/main/php_open_temporary_file.c#php_do_open_temporary_file > * QUESTION3: why is there no error-msg taht $dir is readonly instead unexpected fallback It is how it always work for temp files. Configure the temp directories correctly is the way to go (set the TMP). As far as I remember there was a discussion about temp directories and open base dir a while back, maybe you can find some additional info in it. Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org