Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id C3E549F963A for ; Mon, 3 Sep 2007 20:54:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 73919-03 for ; Mon, 3 Sep 2007 20:53:51 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.190]) by postgresql.org (Postfix) with ESMTP id 4685F9F9630 for ; Mon, 3 Sep 2007 20:54:03 -0300 (ADT) Received: by fk-out-0910.google.com with SMTP id b27so1621137fka for ; Mon, 03 Sep 2007 16:54:00 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=QygxqgCzfR2MquDZcJC1VEj5o5v1HiUSmlnwXj0BsB70iYuec5Hb9efTg9r0Iyk2OUb/OPxRciaj20YCy1VIEBxNbkzYtWDBBi+dOW8iRi5vAdz7LPPf2wpdbLaONgFf3CzzZNR7vlIoHr7joyqg1kR9mX1cErxktqCrQXJZFG4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=lP4MFuUbqMDXqNoxaMPKadyTiQDpoFiCmlVUW5N33NVSSMJH4Ot5j1/yhI7C1vxWOMcbpRKYgzVxXfF8WlzFFlVOJa0jYYGl9NYnrlJz1iKsD+F+1S/gSmk6AxBFRZIeOxcJy7CQ/EQCnbTaVAnhkA/uPS0fgx6vKrYrjcZ1d64= Received: by 10.82.170.2 with SMTP id s2mr1914194bue.1188863640518; Mon, 03 Sep 2007 16:54:00 -0700 (PDT) Received: by 10.82.118.15 with HTTP; Mon, 3 Sep 2007 16:54:00 -0700 (PDT) Message-ID: Date: Mon, 3 Sep 2007 16:54:00 -0700 From: "Ben Tilly" To: "Tom Lane" Subject: Re: tsearch filenames unlikes special symbols and numbers Cc: "Gregory Stark" , "Magnus Hagander" , "Oleg Bartunov" , "Pavel Stehule" , "PostgreSQL Hackers" In-Reply-To: <8195.1188828543@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <162867790709021328i7771aa9jfe79268bccbf123d@mail.gmail.com> <18259.1188773171@sss.pgh.pa.us> <87y7foir7t.fsf@oxford.xeocode.com> <19257.1188777110@sss.pgh.pa.us> <87tzqci6tp.fsf@oxford.xeocode.com> <20070903075609.GD21833@svr2.hagander.net> <1692.1188826039@sss.pgh.pa.us> <87zm03zwqs.fsf@oxford.xeocode.com> <8195.1188828543@sss.pgh.pa.us> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/109 X-Sequence-Number: 107261 On 9/3/07, Tom Lane wrote: > Gregory Stark writes: > > "Tom Lane" writes: > >> I'm not convinced that . is issue-free. On most if not all versions of Unix, > >> you are allowed to open a directory as a file and read the filenames it > >> contains. While I don't say it'd be easy to manage that through > >> tsearch, there's at least a potential for discovering the filenames > >> present in . and .. --- how much do we care about that? > > > Actually I don't think that's true any more, most file systems on most Unixen > > do not allow it. However it appears it's still the case for Solaris so it's > > still a good point. > > Actually, now that I've woken up a bit more, it is not a problem as > long as the tsearch code always appends some kind of file extension > to what the user gives, such as ".dict". It'll be impossible to name > "." or ".." with that addition. I don't know what you're discussing well enough to know if this is relevant, but what you just said is not always true. If there is any way to pass arbitrary binary data into your function call, then someone can pass in a string with nul in it. When that hits the OS API, your appended .dict won't be seen as part of the filename. (This is a common security oversight when calling C APIs from higher-level languages such as Perl. See http://artofhacking.com/files/phrack/phrack55/P55-07.TXT for more.) [...] Cheers, Ben