Commit afb17d91 authored by Bruce Momjian's avatar Bruce Momjian

> I've worked with the Pl/Python code in the past and will see about removing

> rexec and making it an untrusted language.  Last time I looked, it didn't
> look particularly difficult.  I've set aside some time next week, so stay
> tuned.

Attached is a patch that removes all of the RExec code from plpython from
the current PostgreSQL CVS.  In addition, plpython needs to be changed to an
untrusted language in createlang.  Please let me know if there are any
problems.

Kevin Jacobs
parent b24a0293
This diff is collapsed.
......@@ -9,9 +9,5 @@ SELECT invalid_type_reraised('rick');
SELECT valid_type('rick');
-- Security sandbox tests
SELECT read_file('/etc/passwd');
SELECT write_file('/tmp/plpython','This is very bad');
SELECT getpid();
SELECT uname();
SELECT sys_exit();
SELECT sys_argv();
SELECT write_file('/tmp/plpython','Only trusted users should be able to do this!');
SELECT read_file('/tmp/plpython');
......@@ -34,7 +34,7 @@ return SD["call"]
CREATE FUNCTION import_fail() returns text
AS
'try:
import socket
import foosocket
except Exception, ex:
plpy.notice("import socket failed -- %s" % str(ex))
return "failed as expected"
......@@ -304,30 +304,5 @@ CREATE OR REPLACE FUNCTION read_file(text) RETURNS text AS '
CREATE OR REPLACE FUNCTION write_file(text,text) RETURNS text AS '
open(args[0],"w").write(args[1])
return "Wrote to file: %s" % args[0]
' LANGUAGE 'plpython';
CREATE OR REPLACE FUNCTION getpid() RETURNS int4 AS '
import os
return os.getpid()
' LANGUAGE 'plpython';
CREATE OR REPLACE FUNCTION uname() RETURNS int4 AS '
import os
return os.uname()
' LANGUAGE 'plpython';
CREATE OR REPLACE FUNCTION sys_exit() RETURNS text AS '
import sys
return sys.exit()
' LANGUAGE 'plpython';
CREATE OR REPLACE FUNCTION sys_argv() RETURNS text AS '
import sys
return str(sys.argv)
' LANGUAGE 'plpython';
CREATE OR REPLACE FUNCTION sys_version() RETURNS text AS '
import sys
return str(sys.version)
' LANGUAGE 'plpython';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment