diff --git a/application/config/config.php b/application/config/config.php index 811d27f..e4e07a3 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -540,7 +540,8 @@ $config['proxy_ips'] = ''; */ $config['jobe_max_users'] = 10; $config['cputime_upper_limit_secs'] = 50; -$config['clean_up_path'] = '/tmp;/var/tmp;/var/crash;/run/lock'; +#$config['clean_up_path'] = '/tmp;/var/tmp;/var/crash;/run/lock'; +$config['clean_up_path'] = '/var/lib/jobe'; $config['debugging'] = FALSE; /* End of file config.php */ diff --git a/application/controllers/Restapi.php b/application/controllers/Restapi.php index 312115a..2991b63 100644 --- a/application/controllers/Restapi.php +++ b/application/controllers/Restapi.php @@ -172,7 +172,7 @@ class Restapi extends REST_Controller { // Get the the request languages and check it. $language = $run->language_id; - if (!array_key_exists($language, $this->languages)) { + if (!isset($language, $this->languages)) { $this->response("Language '$language' is not known", 400); } $reqdTaskClass = ucwords($language) . '_Task'; diff --git a/application/libraries/LanguageTask.php b/application/libraries/LanguageTask.php index b48d683..263cf34 100644 --- a/application/libraries/LanguageTask.php +++ b/application/libraries/LanguageTask.php @@ -106,7 +106,7 @@ abstract class Task { // to hoover up other students' submissions. public function prepare_execution_environment($sourceCode) { // Create the temporary directory that will be used. - $this->workdir = tempnam("/home/jobe/runs", "jobe_"); + $this->workdir = tempnam("/var/lib/jobe/runs", "jobe_"); if (!unlink($this->workdir) || !mkdir($this->workdir)) { log_message('error', 'LanguageTask constructor: error making temp directory'); throw new Exception("Task: error making temp directory (race error?)"); @@ -185,7 +185,7 @@ abstract class Task { if ($deleteFiles && $this->workdir) { $dir = $this->workdir; - exec("sudo rm -R $dir"); + exec("sudo /bin/rm -R $dir"); $this->workdir = null; } } @@ -278,7 +278,7 @@ abstract class Task { $cputime = $this->getParam('cputime', $iscompile); $numProcs = $this->getParam('numprocs', $iscompile) + 1; // The + 1 allows for the sh command below. $sandboxCommandBits = array( - "sudo " . dirname(__FILE__) . "/../../runguard/runguard", + "sudo /var/www/webapps/jobe/runguard/runguard", "--user={$this->user}", "--group=jobe", "--time=$cputime", // Seconds of execution time allowed diff --git a/application/libraries/filecache.php b/application/libraries/filecache.php index c5a1dc7..01cdab0 100644 --- a/application/libraries/filecache.php +++ b/application/libraries/filecache.php @@ -33,7 +33,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -define('FILE_CACHE_BASE', '/home/jobe/files'); +define('FILE_CACHE_BASE', '/var/lib/jobe/files'); define('MD5_PATTERN', '/[0-9abcdef]{32}/'); define('MAX_PERCENT_FULL', 0.95); define('TESTING_FILE_CACHE_CLEAR', false); diff --git a/runguard/runguard-config.h b/runguard/runguard-config.h index b899f12..ef43be8 100644 --- a/runguard/runguard-config.h +++ b/runguard/runguard-config.h @@ -13,6 +13,6 @@ #define VALID_USERS "domjudge,jobe,jobe00,jobe01,jobe02,jobe03,jobe04,jobe05,jobe06,jobe07,jobe08,jobe09,jobe10,jobe11,jobe12,jobe13,jobe14,jobe15,jobe16,jobe17,jobe18,jobe19" -#define CHROOT_PREFIX "/var/www/jobe/chrootjail" +#define CHROOT_PREFIX "/var/lib/jobe/chrootjail" #endif /* _RUNGUARD_CONFIG_ */ diff --git a/testsubmit.py b/testsubmit.py index 7680548..36d1783 100755 --- a/testsubmit.py +++ b/testsubmit.py @@ -49,8 +49,8 @@ DEBUGGING = False API_KEY = '2AAA7A5415B4A9B394B54BF1D2E9D' # A working (100/hr) key on Jobe2 USE_API_KEY = True -JOBE_SERVER = 'localhost' -RUNS_RESOURCE = '/jobe/index.php/restapi/runs/' +JOBE_SERVER = 'localhost:8089' +RUNS_RESOURCE = '/index.php/restapi/runs/' #JOBE_SERVER = 'jobe2.cosc.canterbury.ac.nz' @@ -211,7 +211,7 @@ def check_code(s): env = os.environ.copy() os.mkdir('Home') env['HOME'] = os.getcwd() + '/Home' - result = subprocess.check_output(['pylint3', '--reports=no', 'source.py'], + result = subprocess.check_output(['pylint.py3', '--reports=no', 'source.py'], universal_newlines=True, stderr=subprocess.STDOUT, env=env) # Fix problem with versions of pylint that insist on telling you # what config file they're using @@ -254,7 +254,7 @@ def check_code(s): env = os.environ.copy() os.mkdir('Home') env['HOME'] = os.getcwd() + '/Home' - result = subprocess.check_output(['pylint3', '--reports=no', 'source.py'], + result = subprocess.check_output(['pylint.py3', '--reports=no', 'source.py'], universal_newlines=True, stderr=subprocess.STDOUT, env=env) # Fix problem with versions of pylint that insist on telling you # what config file they're using @@ -777,7 +777,7 @@ def check_file(file_id): Returns status: 204 denotes file exists, 404 denotes file not found. ''' - resource = '/jobe/index.php/restapi/files/' + file_id + resource = '/index.php/restapi/files/' + file_id headers = {"Accept": "text/plain"} try: connect = http_request('HEAD', resource, '', headers) @@ -806,7 +806,7 @@ def put_file(file_desc): file_id, contents = file_desc contentsb64 = b64encode(contents.encode('utf8')).decode(encoding='UTF-8') data = json.dumps({ 'file_contents' : contentsb64 }) - resource = '/jobe/index.php/restapi/files/' + file_id + resource = '/index.php/restapi/files/' + file_id headers = {"Content-type": "application/json", "Accept": "text/plain"} connect = http_request('PUT', resource, data, headers) @@ -954,7 +954,7 @@ def display_result(comment, ro): def do_get_languages(): """List all languages available on the jobe server""" print("Supported languages:") - resource = '/jobe/index.php/restapi/languages' + resource = '/index.php/restapi/languages' ok, lang_versions = do_http('GET', resource) if not ok: print("**** An exception occurred when getting languages ****")