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 5CF9FDA841 for ; Fri, 21 Oct 2005 15:06:09 -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 77082-02 for ; Fri, 21 Oct 2005 18:06:04 +0000 (GMT) Received: from qproxy.gmail.com (qproxy.gmail.com [72.14.204.205]) by svr1.postgresql.org (Postfix) with ESMTP id 4C919D8307 for ; Fri, 21 Oct 2005 15:06:05 -0300 (ADT) Received: by qproxy.gmail.com with SMTP id m21so37387qbe for ; Fri, 21 Oct 2005 11:06:05 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=Dxo9N0JXcfe+QY6XjRTLK4V7txowBlG5s1Gen67VIl7wvTwjXUDnhoeWJfNiVnml+jrL+BtWDkP2TahwpDYALi8pz8zVck0/fYdqFA7BOYTIdx39zYG1JQlhA0op63NlJjuatdvrWIYqa7ENo7lbPuVJmYv3KgLaN75rSUhT9bs= Received: by 10.64.142.3 with SMTP id p3mr2171831qbd; Fri, 21 Oct 2005 11:06:05 -0700 (PDT) Received: by 10.64.183.10 with HTTP; Fri, 21 Oct 2005 11:06:05 -0700 (PDT) Message-ID: <762e5c0510211106m12896b11t5d6ab62865620b5d@mail.gmail.com> Date: Fri, 21 Oct 2005 13:06:05 -0500 From: Bob To: pgsql-docs@postgresql.org Subject: Minor changed needed to doc on untrusted pl/perl example MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10505_13997708.1129917965182" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.361 required=5 tests=[HTML_20_30=0.504, HTML_MESSAGE=0.001, RCVD_BY_IP=0.024, RCVD_IN_BL_SPAMCOP_NET=1.832] X-Spam-Level: ** X-Archive-Number: 200510/60 X-Sequence-Number: 3305 ------=_Part_10505_13997708.1129917965182 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I know this is minor but we all long for perfection.:) The current doc shows 37.5. Trusted and Untrusted PL/Perl Normally, PL/Perl is installed as a "trusted" programming language named plperl. In this setup, certain Perl operations are disabled to preserve security. In general, the operations that are restricted are those that interact with the environment. This includes file handle operations, requir= e, and use (for external modules). There is no way to access internals of the database server process or to gain OS-level access with the permissions of the server process, as a C function can do. Thus, any unprivileged database user may be permitted to use this language. Here is an example of a function that will not work because file system operations are not allowed for security reasons: 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; ------=_Part_10505_13997708.1129917965182 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I know this is minor but we all long for perfection.:)

The current doc shows

37.5. Trusted and Untrusted = PL/Perl

Normally, PL/Perl is installed as a "trust= ed" programming language named plperl<= /tt>. In this setup, certain Perl operations are disabled to preserve security. In general, the operations that are restricted are those that interact with the environment. This includes file handle operations, require, and use (for external modules). There is no way to access internals of the database server process or to gain OS-level access with the permissions of the server process, as a C function can do. Thus, any unprivileged database user may be permitted to use this language.

Here is an example of a function that will not work because file s= ystem operations are not allowed for security reasons:

CREATE FUNCTION badfunc() RETURNS integer AS =
$$
open(TEMP, ">/tmp/badfile");
print TEMP "= ;Gotcha!\n";
return 1;
$$ LANGUAGE plperl;


I beli= eve the code snippet should look like this for it to work correctly:


CREATE FUNCTION badfunc() RETURNS integer AS $$
open(TEM= P, ">/tmp/badfile");
print TEMP "Gotcha!\n";<= br> close(TEMP);
return 1;
$$ LANGUAGE plperl;
------=_Part_10505_13997708.1129917965182--