summaryrefslogtreecommitdiff
path: root/python_server.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2011-11-12 23:46:12 +0530
committerPrabhu Ramachandran2011-11-12 23:46:12 +0530
commitb9c42580676c0b130d3de38305a5ef18cb5e441a (patch)
tree354a20f9db8e76f621f51bed71208237d9fa2dae /python_server.py
parentfb31dcc7693395c9856fb19c3e867fbfa2e9b4f8 (diff)
downloadonline_test-b9c42580676c0b130d3de38305a5ef18cb5e441a.tar.gz
online_test-b9c42580676c0b130d3de38305a5ef18cb5e441a.tar.bz2
online_test-b9c42580676c0b130d3de38305a5ef18cb5e441a.zip
ENH/BUG: Python server bug and user directory
The Python server was not setting the effective gid. There was also a bug in that traceback was not imported. Added option so that the python server chdirs to a user specific directory in order that a user can save files which could be used as part of the test.
Diffstat (limited to 'python_server.py')
-rwxr-xr-xpython_server.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/python_server.py b/python_server.py
index debd73d..1670f90 100755
--- a/python_server.py
+++ b/python_server.py
@@ -4,13 +4,16 @@ and returns the output. It *should* be run as root and will run as the user
'nobody' so as to minimize any damange by errant code.
"""
import sys
+import traceback
from SimpleXMLRPCServer import SimpleXMLRPCServer
import pwd
import os
+from os.path import isdir
# Set the effective uid
nobody = pwd.getpwnam('nobody')
+os.setegid(nobody.pw_gid)
os.seteuid(nobody.pw_uid)
@@ -26,7 +29,7 @@ def run_code(answer, test_code, in_dir=None):
A tuple: (success, error message).
"""
- if in_dir is not None:
+ if in_dir is not None and isdir(in_dir):
os.chdir(in_dir)
success = False