X-Original-To: pgsql-docs-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7FEE3DA84C for ; Fri, 21 Oct 2005 17:51:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90940-03 for ; Fri, 21 Oct 2005 20:51:18 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id BA4C3D6D9E for ; Fri, 21 Oct 2005 17:51:19 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j9LKpHxV097643 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 21 Oct 2005 14:51:19 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id j9LKpGkg012071; Fri, 21 Oct 2005 14:51:16 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id j9LKpGNS012070; Fri, 21 Oct 2005 14:51:16 -0600 (MDT) (envelope-from mfuhr) Date: Fri, 21 Oct 2005 14:51:16 -0600 From: Michael Fuhr To: Bob Cc: pgsql-docs@postgresql.org Subject: Re: Minor changed needed to doc on untrusted pl/perl example Message-ID: <20051021205116.GA9396@winnie.fuhr.org> References: <762e5c0510211106m12896b11t5d6ab62865620b5d@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <762e5c0510211106m12896b11t5d6ab62865620b5d@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200510/61 X-Sequence-Number: 3306 On Fri, Oct 21, 2005 at 01:06:05PM -0500, Bob wrote: > CREATE FUNCTION badfunc() RETURNS integer AS $$ > open(TEMP, ">/tmp/badfile"); > print TEMP "Gotcha!\n"; > return 1; > $$ LANGUAGE plperl; > > I believe the code snippet should look like this for it to work correctly: > > CREATE FUNCTION badfunc() RETURNS integer AS $$ > open(TEMP, ">/tmp/badfile"); > print TEMP "Gotcha!\n"; > close(TEMP); > return 1; > $$ LANGUAGE plperl; The function should work without an explicit close (or it would, but for the security check). The file should appear on disk immediately after the open, although the data might not be flushed to disk until the file is actually closed, such as when the calling session's postmaster exits (that's how a plperlu version behaves on my test system, anyway). Not that I disagree with adding an explicit close, but the example should still "work" without it. -- Michael Fuhr