[PATCH] untrusted plperl - Mailing list pgsql-hackers

From Alex Pilosov
Subject [PATCH] untrusted plperl
Date
Msg-id Pine.BSO.4.10.10106161941440.17529-200000@spider.pilosoft.com
Whole thread Raw
Responses Re: [PATCH] untrusted plperl  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [PATCH] untrusted plperl  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Well, after persuading cvsup and cvs that it _is_ possible to have local
modifiable repositories, I have a clean untrusted plperl patch to offer
you :)

Highlights:
* There's one perl interpreter used for both trusted and untrusted
procedures. I do think its unnecessary to keep two perl
interpreters around. If someone can break out from trusted "Safe" perl 
mode, well, they can do what they want already. If someone disagrees, I
can change this.

* Opcode is not statically loaded anymore. Instead, we load Dynaloader,
which then can grab Opcode (and anything else you can 'use') on its own.

* Checked to work on FreeBSD 4.3 + perl 5.5.3 , OpenBSD 2.8 + perl5.6.1,
RedHat 6.2 + perl 5.5.3

* Uses ExtUtils::Embed to find what options are necessary to link with
perl shared libraries

* createlang is also updated, it can create untrusted perl using 'plperlu'

* Example script (assuming you have Mail::Sendmail installed):
create function foo() returns text as '        use Mail::Sendmail;
        %mail = ( To      => q(you@yourname.com),                  From    => q(me@here.com),                  Message
=>"This is a very short message"                 );        sendmail(%mail) or die $Mail::Sendmail::error;
 
return          "OK. Log says:\n", $Mail::Sendmail::log;
' language 'plperlu';


(well, change the name in the To: line :)


Hope someone finds that useful and maybe even merged :)

-alex

pgsql-hackers by date:

Previous
From: Alex Pilosov
Date:
Subject: Re: RTLD_GLOBAL on openbsd
Next
From: Alex Pilosov
Date:
Subject: [PATCH] inet << indexability (take 3)