From afb17d912b4cb39dc31346dbb1d4816d5d0d687c Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 25 Jun 2003 01:18:58 +0000 Subject: > 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 --- src/pl/plpython/plpython_function.sql | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'src/pl/plpython/plpython_function.sql') diff --git a/src/pl/plpython/plpython_function.sql b/src/pl/plpython/plpython_function.sql index 2769e9de36f..82a3c0c9598 100644 --- a/src/pl/plpython/plpython_function.sql +++ b/src/pl/plpython/plpython_function.sql @@ -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'; - -- cgit v1.2.3