Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 50097 invoked from network); 11 Dec 2007 16:59:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Dec 2007 16:59:04 -0000 Received: (qmail 37251 invoked by uid 500); 11 Dec 2007 16:58:53 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 36873 invoked by uid 500); 11 Dec 2007 16:58:52 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 36862 invoked by uid 99); 11 Dec 2007 16:58:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2007 08:58:52 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of michael@metaparadigm.com designates 203.117.131.43 as permitted sender) Received: from [203.117.131.43] (HELO metamail-vm.metaparadigm.com) (203.117.131.43) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2007 16:58:52 +0000 Received: from [192.168.133.111] (cm15.gamma103.maxonline.com.sg [202.156.103.15]) (authenticated bits=0) by metamail-vm.metaparadigm.com (8.13.8/8.13.8/Debian-3) with ESMTP id lBBGwB1V029343 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 12 Dec 2007 00:58:12 +0800 Message-ID: <475EC19F.8040906@metaparadigm.com> Date: Wed, 12 Dec 2007 00:58:07 +0800 From: Michael Clark Organization: Metaparadigm Pte Ltd User-Agent: Mozilla-Thunderbird 2.0.0.6 (X11/20071009) MIME-Version: 1.0 To: Lucian Adrian Grijincu CC: "William A. Rowe, Jr." , Iain Wade , dev@apr.apache.org Subject: Re: apr_os_dir_put fixes References: <475E944F.3030707@rowe-clan.net> <475EB4A8.8030409@metaparadigm.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.90.1/5091/Tue Dec 11 20:41:37 2007 on metamail-vm X-Virus-Status: Clean X-Virus-Checked: Checked by ClamAV on apache.org Lucian Adrian Grijincu wrote: > On Dec 11, 2007 6:02 PM, Michael Clark wrote: > >> Lucian Adrian Grijincu wrote: >> >>> apart from the versioning detail, Iain raises a valid problem (bug) in APR: >>> >> Yes, although even with the allocation fixed, without dirname set >> correctly, it will also not be able to do the apr_stat calls if they are >> 'wanted' in apr_dir_read. >> >> > > A few things can still be found without changing the interface. > struct dirent { > ino_t d_ino; /* inode number */ > off_t d_off; /* offset to the next dirent */ > unsigned short d_reclen; /* length of this record */ > unsigned char d_type; /* type of file */ > char d_name[256]; /* filename */ > }; > > The ino, type and name of the file can still be found, but not more. > so, if you only need APR_FINFO_NAME|APR_FINFO_INODE|DIRENT_TYPE or > less, you could go from here. > Also, if you have the dirname to begin with, you can concatenate that > with the .name member set up by apr_dir_read in apr_finfo_t and do it > manually. > Or am I missing something? > A use case example is making some existing code that reads from an apr_dir_t work with an apr_dir_t that has been created using apr_os_dir_put. Some code (e.g. mod_autoindex) is minimally changed to call a portable interface that normally just dispatches to apr_dir_open. When a privilege seperation feature is enabled, it instead delegates to a routine that requests the directory file descriptors be sent over a socket (or potentially a file handle over a memory file on windows). By being able to set the dirname, have the apr_dir_t properly allocated, this existing code can be changed minimally (a couple of 1 line changes). With the limitations mentioned above, it would need to be changed in a much more complicated way - ie. changing the wanted mask, adding extra apr_stat calls, changing the dir_close call (for cleanup to work), etc