aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcassiopc <cassiopc@gmail.com>2015-09-11 14:42:05 +0000
committercassiopc <cassiopc@gmail.com>2015-09-11 14:42:05 +0000
commit5702d8cdcaf4784545a893657edf5e5429bc0cc8 (patch)
tree453ab55ecbd79547f121ae6a2d9657d696a1cdf7
parentf9f21ae94bbdcc63907e46271cd87b7a588e1baf (diff)
parent40ed6646e902830881fe2c530ce110d73f5a5a0b (diff)
downloadboca-5702d8cdcaf4784545a893657edf5e5429bc0cc8.tar.gz
boca-5702d8cdcaf4784545a893657edf5e5429bc0cc8.zip
Merge branch 'master' of github.com:cassiopc/boca
-rw-r--r--src/frun.php20
-rwxr-xr-xsrc/globals.php10
-rwxr-xr-xsrc/private/autojudging.php55
-rw-r--r--src/scoretable.php2
-rw-r--r--src/staff/task.php47
-rw-r--r--src/team/run.php25
-rwxr-xr-xtools/etc/icpc/installboca.sh1
-rwxr-xr-xtools/etc/icpc/setup.sh4
-rw-r--r--tools/etc/network/if-up.d/boca13
-rwxr-xr-xtools/installv2.sh9
10 files changed, 133 insertions, 53 deletions
diff --git a/src/frun.php b/src/frun.php
index e272b85..bdd1a02 100644
--- a/src/frun.php
+++ b/src/frun.php
@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////////////
-// Last modified 06/sep/2013 by cassio@ime.usp.br
+// Last modified 09/sep/2015 by cassio@ime.usp.br
function DBDropRunTable() {
$c = DBConnect();
@@ -705,7 +705,7 @@ function DBNewRun($param,$c=null) {
DBExec($c, "rollback work", "DBNewRun(rollback-site)");
LOGError("Unable to find a unique site/contest in the database. SQL=(" . $sql . ")");
MSGError("Unable to find a unique site/contest in the database.");
- exit;
+ return false;
}
$a = DBRow($r,0);
$n = $a["nextrun"] + 1;
@@ -735,13 +735,13 @@ function DBNewRun($param,$c=null) {
DBExec($c, "rollback work", "DBNewRun(rollback-started)");
LOGError("Tried to submit a run but the contest is not started. SQL=(" . $sql . ")");
MSGError("The contest is not started yet!");
- return false;
+ return 0;
} }
if (!$b["siterunning"]) {
DBExec($c, "rollback work", "DBNewRun(rollback-over)");
LOGError("Tried to submit a run but the contest is over. SQL=(" . $sql . ")");
MSGError("The contest is over!");
- return false;
+ return 0;
}
} else {
$dif = $rundatediff;
@@ -759,14 +759,14 @@ function DBNewRun($param,$c=null) {
DBExec($c, "rollback work", "DBNewRun(rollback-import stdout)");
LOGError("Unable to create a large object for file stdout (run=$runnumber,site=$site,contest=$contest).");
MSGError("problem importing stdout to database. Contact an admin now!");
- exit;
+ return false;
}
} else {
if($autostdout != '') {
DBExec($c, "rollback work", "DBNewRun(rollback-import stderr)");
LOGError("Unable to create a large object for file stdout that is not BASE64 (run=$runnumber,site=$site,contest=$contest).");
MSGError("problem importing stdout (not BASE64) to database. Contact an admin now!");
- exit;
+ return false;
}
$oid1 = 'NULL';
}
@@ -778,14 +778,14 @@ function DBNewRun($param,$c=null) {
DBExec($c, "rollback work", "DBNewRun(rollback-import stderr)");
LOGError("Unable to create a large object for file stderr (run=$runnumber,site=$site,contest=$contest).");
MSGError("problem importing stderr to database. Contact an admin now!");
- exit;
+ return false;
}
} else {
if($autostderr != '') {
DBExec($c, "rollback work", "DBNewRun(rollback-import stderr)");
LOGError("Unable to create a large object for file stderr that is not BASE64 (run=$runnumber,site=$site,contest=$contest).");
MSGError("problem importing stderr (not BASE64) to database. Contact an admin now!");
- exit;
+ return false;
}
$oid2 = 'NULL';
}
@@ -797,7 +797,7 @@ function DBNewRun($param,$c=null) {
DBExec($c, "rollback work", "DBNewRun(rollback-import)");
LOGError("DBNewRun: Unable to create a large object for file $filepath.");
MSGError("problem importing file $filepath to database. Contact an admin now!");
- exit;
+ return false;
}
} else {
$filepath = base64_decode(substr($filepath,7));
@@ -805,7 +805,7 @@ function DBNewRun($param,$c=null) {
DBExec($c, "rollback work", "DBNewRun(rollback-import)");
LOGError("DBNewRun: Unable to create a large object for file.");
MSGError("problem importing file to database. Contact an admin now!");
- exit;
+ return false;
}
}
DBExec($c, "INSERT INTO runtable (contestnumber, runsitenumber, runnumber, usernumber, rundate, " .
diff --git a/src/globals.php b/src/globals.php
index 0f034ce..5ece1e8 100755
--- a/src/globals.php
+++ b/src/globals.php
@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////////////
-// Last modified 15/aug/2014 by cassio@ime.usp.br
+// Last modified 07/sep/2015 by cassio@ime.usp.br
require_once('db.php');
define("dbcompat_1_4_1",true);
@@ -205,13 +205,13 @@ function IntrusionNotify($where) {
// verifica se a sessao esta aberta e ok
function ValidSession() {
if (!isset($_SESSION["usertable"])) return(FALSE);
+ if ($_SESSION["usertable"]["usersession"] == session_id() || $_SESSION["usertable"]["usersessionextra"] == session_id()) return(TRUE);
+ if(($_SESSION["usertable"]["userip"] == getIP() && $_SESSION["usertable"]["usermultilogin"] == 't') ||
+ $_SESSION["usertable"]["usertype"] == 'score') return(TRUE);
$_SESSION["usertable"] = DBUserInfo($_SESSION["usertable"]["contestnumber"],
$_SESSION["usertable"]["usersitenumber"],
$_SESSION["usertable"]["usernumber"]);
- if ($_SESSION["usertable"]["usersession"] != session_id() &&
- ($_SESSION["usertable"]["usermultilogin"] != 't' ||
- $_SESSION["usertable"]["usertype"] != 'score'))
- return(FALSE);
+ if ($_SESSION["usertable"]["usersession"] != session_id() && $_SESSION["usertable"]["usersessionextra"] != session_id()) return(FALSE);
return(TRUE);
}
// grava erro no arquivo de log
diff --git a/src/private/autojudging.php b/src/private/autojudging.php
index 4994303..d4f9719 100755
--- a/src/private/autojudging.php
+++ b/src/private/autojudging.php
@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////////////
-// Last modified 13/sep/2013 by cassio@ime.usp.br
+// Last modified 10/sep/2015 by cassio@ime.usp.br
$ds = DIRECTORY_SEPARATOR;
if($ds=="") $ds = "/";
@@ -127,8 +127,8 @@ for($i=0; $i<5; $i++) {
}
if($i>=5) {
echo "It was not possible to create a unique temporary directory\n";
- LogLevel("Autojuging: Unable to create temp directory (run=$number, site=$site, contest=$contest)",1);
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem creating temp directory");
+ LogLevel("Autojudging: Unable to create temp directory (run=$number, site=$site, contest=$contest)",1);
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: problem creating temp directory");
continue;
}
chdir($dir);
@@ -136,15 +136,15 @@ chdir($dir);
echo "Using directory $dir (contest=$contest, site=$site, run=$number)\n";
if($run["sourceoid"]=="" || $run["sourcename"]=="") {
- LogLevel("Autojuging: Source file not defined (run=$number, site=$site, contest=$contest)",1);
+ LogLevel("Autojudging: Source file not defined (run=$number, site=$site, contest=$contest)",1);
echo "Source file not defined (contest=$contest, site=$site, run=$number)\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: source file not defined");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: source file not defined");
continue;
}
if($run["inputoid"]=="" || $run["inputname"]=="") {
- LogLevel("Autojuging: problem package not defined (run=$number, site=$site, contest=$contest)",1);
+ LogLevel("Autojudging: problem package not defined (run=$number, site=$site, contest=$contest)",1);
echo "Package file not defined (contest=$contest, site=$site, run=$number)\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file not defined");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: problem package file not defined");
continue;
}
$c = DBConnect();
@@ -153,7 +153,7 @@ if(DB_lo_export($contest,$c, $run["sourceoid"], $dir . $ds . $run["sourcename"])
DBExec($c, "rollback work", "Autojudging(rollback-source)");
LogLevel("Autojudging: Unable to export source file (run=$number, site=$site, contest=$contest)",1);
echo "Error exporting source file ${run["sourcename"]} (contest=$contest, site=$site, run=$number)\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: unable to export source file");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: unable to export source file");
DBExec($c, "commit", "Autojudging(exportcommit)");
continue;
}
@@ -169,7 +169,7 @@ if(is_readable($cache . $ds . $run["inputoid"] . "." . $run["inputname"])) {
DBExec($c, "rollback work", "Autojudging(rollback-input)");
LogLevel("Autojudging: Unable to export problem package file (run=$number, site=$site, contest=$contest)",1);
echo "Error exporting problem package file ${run["inputname"]} (contest=$contest, site=$site, run=$number)\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: unable to export problem package file");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: unable to export problem package file");
DBExec($c, "commit", "Autojudging(exportcommit)");
continue;
}
@@ -184,13 +184,13 @@ if(is_readable($cache . $ds . $run["inputoid"] . "." . $run["inputname"])) {
$zip->close();
} else {
echo "Failed to unzip the package file -- please check the problem package (maybe it is encrypted?)\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid (1)");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: problem package file is invalid (1)");
cleardir($dir . $ds . "problemdata");
continue;
}
if(($info=@parse_ini_file($dir . $ds . "problemdata" . $ds . "description" . $ds . 'problem.info'))===false) {
echo "Problem content missing (description/problem.info) -- please check the problem package\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid (2)");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: problem package file is invalid (2)");
cleardir($dir . $ds . "problemdata");
continue;
}
@@ -200,14 +200,14 @@ if(is_readable($cache . $ds . $run["inputoid"] . "." . $run["inputname"])) {
$fullname=trim(sanitizeText($info['fullname']));
if($basename=='') {
echo "Problem content missing (description/problem.info) -- please check the problem package\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid (3)");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: problem package file is invalid (3)");
cleardir($dir . $ds . "problemdata");
continue;
}
$basenames[$run['inputoid']. "." . $run["inputname"]]=$basename;
if(!is_dir($dir . $ds . "problemdata" . $ds . "limits")) {
echo "Problem content missing (limits) -- please check the problem package\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid (4)");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: problem package file is invalid (4)");
cleardir($dir . $ds . "problemdata");
continue;
}
@@ -223,7 +223,7 @@ if(is_readable($cache . $ds . $run["inputoid"] . "." . $run["inputname"])) {
if(system($ex, $retval)===false) $retval=-1;
if($retval != 0) {
echo "Error running script -- please check the problem package\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid (5)");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: problem package file is invalid (5)");
cleardir($dir . $ds . "problemdata");
continue;
}
@@ -246,7 +246,7 @@ if(is_readable($cache . $ds . $run["inputoid"] . "." . $run["inputname"])) {
echo "\n=====stdout======\n";
echo file_get_contents('stdout');
echo "\n===========\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: internal test script failed (" . $file . ")");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: internal test script failed (" . $file . ")");
$cont=true;
break;
}
@@ -264,7 +264,7 @@ if(!isset($limits[$basename][$run["extension"]][0]) || !is_numeric($limits[$base
!isset($limits[$basename][$run["extension"]][2]) || !is_numeric($limits[$basename][$run["extension"]][2]) ||
!isset($limits[$basename][$run["extension"]][3]) || !is_numeric($limits[$basename][$run["extension"]][3]) ) {
echo "Failed to find proper limits information for the problem -- please check the problem package\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid (6)");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: problem package file is invalid (6)");
continue;
}
@@ -281,14 +281,14 @@ if ($zip->open($dir . $ds . $run["inputname"]) === true) {
$zip->close();
} else {
echo "Failed to unzip the package file -- please check the problem package\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid (7)");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: problem package file is invalid (7)");
continue;
}
$script = $dir . $ds . 'compile' . $ds . $run["extension"];
if(!is_file($script)) {
echo "Error (not found) compile script for ".$run["extension"]." -- please check the problem package\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: compile script failed (".$run["extension"].")");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: compile script failed (".$run["extension"].")");
continue;
}
@@ -345,28 +345,33 @@ if($retval != 0) {
$outputlist[$noutputlist++] = 'output' . $ds . basename($filename,'.link');
}
}
+ if($ninputlist == 0) {
+ echo "WARN: There are NO input files in ZIP package -- should check the problem package?\n";
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "warning: problem package has no input files");
+ continue;
+ }
$zip->extractTo($dir, array_merge(array("run" . $ds . $run["extension"]),array("compare" . $ds . $run["extension"]),$inputlist,$outputlist));
$zip->close();
if(chmod($dir . $ds . 'output', 0700)==false || chown($dir . $ds . 'output','root') == false) {
echo "Failed to chown/chdir the output folder -- please check the system and problem package\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: chown/chmod failed for output (99)");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: chown/chmod failed for output (99)");
continue;
}
if(chmod($dir . $ds . 'compare', 0700)==false || chown($dir . $ds . 'compare','root') == false) {
echo "Failed to chown/chdir the output folder -- please check the system and problem package\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: chown/chmod failed for output (99)");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: chown/chmod failed for output (99)");
continue;
}
} else {
echo "Failed to unzip the file (inputs) -- please check the problem package\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid (8)");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: problem package file is invalid (8)");
continue;
}
$retval = 0;
$script = $dir . $ds . 'run' . $ds . $run["extension"];
if(!is_file($script)) {
echo "Failed to unzip the run script -- please check the problem package\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid (9)");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: problem package file is invalid (9)");
continue;
}
chdir($dir);
@@ -379,7 +384,7 @@ if($retval != 0) {
if($ninputlist == 0) {
echo "WARN: There are NO input files in ZIP package -- should check the problem package?\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging warning: problem package has no input files");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "warning: problem package has no input files");
continue;
} else {
$errp=0;
@@ -396,7 +401,7 @@ if($retval != 0) {
@copy($fnam,$dir . $ds . "input" . $ds . $file);
} else {
echo "Failed to read input files from link indicated in the ZIP -- please check the problem package\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid (11) or missing files on the autojudge");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: problem package file is invalid (11) or missing files on the autojudge");
$errp=1; break;
}
}
@@ -522,7 +527,7 @@ if($retval != 0) {
$zip->close();
} else {
echo "Failed to unzip the file (outputs) -- please check the problem package\n";
- DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid (12)");
+ DBGiveUpRunAutojudging($contest, $site, $number, $ip, "error: problem package file is invalid (12)");
continue;
}
$script = $dir . $ds . 'compare' . $ds . $run["extension"];
diff --git a/src/scoretable.php b/src/scoretable.php
index 6efec4a..18c57ba 100644
--- a/src/scoretable.php
+++ b/src/scoretable.php
@@ -87,7 +87,7 @@ if(isset($scoredelay[$_SESSION["usertable"]["usertype"]])) $actualdelay = $score
$ds = DIRECTORY_SEPARATOR;
if($ds=="") $ds = "/";
-$scoretmp = $_SESSION["locr"] . $ds . "private" . $ds . "scoretmp" . $ds . $_SESSION["usertable"]["usertype"] . ".php";
+$scoretmp = $_SESSION["locr"] . $ds . "private" . $ds . "scoretmp" . $ds . $_SESSION["usertable"]["usertype"] . '-' . $_SESSION["usertable"]["username"] . ".php";
$redo = TRUE;
if(file_exists($scoretmp)) {
if(($strtmp = file_get_contents($scoretmp,FALSE,NULL,-1,100000)) !== FALSE) {
diff --git a/src/staff/task.php b/src/staff/task.php
index 640eae1..a447429 100644
--- a/src/staff/task.php
+++ b/src/staff/task.php
@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////////////
-// Last modified 05/aug/2012 by cassio@ime.usp.br
+// Last modified 07/sep/2015 by cassio@ime.usp.br
require('header.php');
if(($ct = DBContestInfo($_SESSION["usertable"]["contestnumber"])) == null)
@@ -67,8 +67,49 @@ if (($s=DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"
$task = DBOpenTasksInSites($_SESSION["usertable"]["contestnumber"], $s["sitetasking"]);
+$ds = DIRECTORY_SEPARATOR;
+if($ds=="") $ds = "/";
+$limittasks=false;
+if(is_readable($_SESSION["locr"] . $ds . 'private' . $ds . 'score.sep')) {
+ $limittasks=true;
+ $rf=file($_SESSION["locr"] . $ds . 'private' . $ds . 'score.sep');
+ for($rfi=1;$rfi<=count($rf);$rfi++) {
+ $lin = explode('#',trim($rf[$rfi-1]));
+ if(isset($lin[1]) && $_SESSION["usertable"]["usertype"]!='admin') {
+ $arr=explode(' ',trim($lin[1]));
+ for($arri=0;$arri<count($arr);$arri++)
+ if(preg_match($arr[$arri],$_SESSION["usertable"]["username"])) break;
+ if($arri>=count($arr)) continue;
+ }
+ $lin = trim($lin[0]);
+ if($lin=='') continue;
+ $grname=explode(' ',$lin);
+
+ for ($i=0; $i<count($task); $i++) {
+ for($k=1;$k<count($grname);$k++) {
+ if($task[$i]["site"]==$grname[$k]) {
+ $task[$i]["ok"]=true;
+ break;
+ }
+ else if(strpos($grname[$k],'/') >= 1) {
+ $u1 = explode('/',$grname[$k]);
+ if(isset($u1[1]) && $task[$i]["user"] >= $u1[0] && $task[$i]["user"] <= $u1[1]) {
+ if(!isset($u1[2]) || $u1[2]==$task[$i]["site"]) {
+ $task[$i]["ok"]=true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+$anyprinted=false;
for ($i=0; $i<count($task); $i++) {
- $st = $task[$i]["status"];
+ if($limittasks && (!isset($task[$i]["ok"]) || $task[$i]["ok"]!=true)) continue;
+ $anyprinted=true;
+ $st = $task[$i]["status"];
if($st == "processing" && $task[$i]["staff"]==$_SESSION["usertable"]["usernumber"] &&
$task[$i]["staffsite"]==$_SESSION["usertable"]["usersitenumber"]) $mine=1;
@@ -121,7 +162,7 @@ for ($i=0; $i<count($task); $i++) {
echo "&nbsp;</td>\n";
}
echo "</table>";
-if (count($task) == 0) echo "<br><center><b><font color=\"#ff0000\">NO TASKS FOUND</font></b></center>";
+if (!$anyprinted) echo "<br><center><b><font color=\"#ff0000\">NO TASKS FOUND</font></b></center>";
?>
diff --git a/src/team/run.php b/src/team/run.php
index 846fef0..c7add5d 100644
--- a/src/team/run.php
+++ b/src/team/run.php
@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////////////
-// Last modified 08/aug/2015 by cassio@ime.usp.br
+// Last modified 09/sep/2015 by cassio@ime.usp.br
require('header.php');
$ds = DIRECTORY_SEPARATOR;
if($ds=="") $ds = "/";
@@ -136,7 +136,7 @@ if (isset($_POST["problem"]) && isset($_POST["language"]) &&
} else {
$pastval = 0;
}
- $verify = $pastcode . '-' .$_SESSION["usertable"]["contestnumber"].'-'.$_SESSION["usertable"]["usersitenumber"].'-'.$_SESSION["usertable"]["usernumber"];
+ $verify = $pastcode . '-' .$name . '-'. $_SESSION["usertable"]["contestnumber"].'-'.$_SESSION["usertable"]["usersitenumber"].'-'.$_SESSION["usertable"]["usernumber"];
$fcname = $_SESSION["locr"] . $ds . "private" . $ds . 'laterun-submitted-' . $_SESSION["usertable"]["contestnumber"].'-'.
$_SESSION["usertable"]["usersitenumber"].'-'.$_SESSION["usertable"]["usernumber"].'.txt';
$codes = @file($fcname,FILE_IGNORE_NEW_LINES);
@@ -149,9 +149,15 @@ if (isset($_POST["problem"]) && isset($_POST["language"]) &&
$dif = $b["currenttime"];
$param['rundatediff']=$dif - $pastval;
}
- if(DBNewRun ($param) == 2)
+ $retv = DBNewRun ($param);
+ if($retv == 2) {
@file_put_contents($fcname, $verify . "\n", FILE_APPEND | LOCK_EX);
- echo "\nRESULT: RUN SUBMITTED SUCCESSFULLY ($pastval)";
+ echo "\nRESULT: RUN SUBMITTED SUCCESSFULLY ($pastval)";
+ } else {
+ if($retv == 0) echo "\nRESULT: CONTEST NOT RUNNING";
+ else
+ echo "\nRESULT: UNKNOWN PROBLEM";
+ }
}
exit;
}
@@ -159,8 +165,11 @@ if (isset($_POST["problem"]) && isset($_POST["language"]) &&
if(isset($_POST['name']) && $_POST['name'] != '') {
if($retv == 2)
echo "\nRESULT: RUN SUBMITTED SUCCESSFULLY";
- else
- echo "\nRESULT: UNKNOWN PROBLEM";
+ else {
+ if($retv == 0) echo "\nRESULT: CONTEST NOT RUNNING";
+ else
+ echo "\nRESULT: UNKNOWN PROBLEM";
+ }
exit;
}
$_SESSION['forceredo']=true;
@@ -234,7 +243,7 @@ $linesubmission = @file_get_contents($_SESSION["locr"] . $ds . "private" . $ds .
if(trim($linesubmission) == '1') {
$strtmp .= "<br><br><center><b>To submit a program, use the command-line tool:</b>\n<br>".
"<pre>boca-submit-run USER PASSWORD PROBLEM LANGUAGE FILE</pre><br>".
- "where USER is your username, PASSWORD is your password, FILE is your submission file,<br>".
+ "where USER is your username, PASSWORD is your password, <br>".
"PROBLEM is one of { ";
$prob = DBGetProblems($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usertype"]=='judge');
@@ -244,7 +253,7 @@ $strtmp .= "} and<br>LANGUAGE is one of { ";
$lang = DBGetLanguages($_SESSION["usertable"]["contestnumber"]);
for ($i=0;$i<count($lang);$i++)
$strtmp .= $lang[$i]["name"] . " ";
-$strtmp .= "}<br><br>\n";
+$strtmp .= "}<br>FILE is your submission file<br><br>\n";
} else {
$strtmp .= "<br><br><center><b>To submit a program, just fill in the following fields:</b></center>\n".
diff --git a/tools/etc/icpc/installboca.sh b/tools/etc/icpc/installboca.sh
index 88c266f..d796c04 100755
--- a/tools/etc/icpc/installboca.sh
+++ b/tools/etc/icpc/installboca.sh
@@ -217,6 +217,7 @@ echo "=================================================="
echo "=================== SERVER SETUP ==============="
echo "=================================================="
ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini 2>/dev/null
+ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/cli/conf.d/20-mcrypt.ini 2>/dev/null
OK=n
echo "You can run at anytime later the script /etc/icpc/becomeserver.sh to prepare the computer to be the BOCA server"
diff --git a/tools/etc/icpc/setup.sh b/tools/etc/icpc/setup.sh
index 5d8838f..62563e1 100755
--- a/tools/etc/icpc/setup.sh
+++ b/tools/etc/icpc/setup.sh
@@ -4,7 +4,7 @@ if [ ! -x /etc/icpc/bocaserver.sh ]; then
OK=1
while [ "$OK" != "0" ]; do
IP=`zenity --title="Setting up the BOCA server IP number" --text="Enter the IP address of the server (format x.y.w.z)\n\
-If this is supposed to be the server, then leave it empty\nIf there are multiple servers, separate IPs by a semi-colon ;" --width=500 --height=100 --entry`
+If this is supposed to be the server, then leave it empty\nIf there are multiple servers, separate IPs by a semi-colon ;" --entry`
[ "$IP" == "" ] && IP=LOCAL
zenity --title="IP confirmation" --text="The chosen IP is $IP\nDo you confirm?" --question
OK=$?
@@ -94,3 +94,5 @@ fi
if [ -x /etc/network/if-pre-up.d/boca ]; then
. /etc/network/if-pre-up.d/boca
fi
+
+exit 0
diff --git a/tools/etc/network/if-up.d/boca b/tools/etc/network/if-up.d/boca
index 0f31ee0..20ff38f 100644
--- a/tools/etc/network/if-up.d/boca
+++ b/tools/etc/network/if-up.d/boca
@@ -6,9 +6,22 @@ fi
/sbin/iptables -F INPUT
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A INPUT -s 143.107.255.15 -j ACCEPT
+
+# just to make things easier, let's allow communication to/from BOCA servers
+/sbin/iptables -A INPUT -s 45.33.30.235 -j ACCEPT
+/sbin/iptables -A INPUT -s 50.116.19.221 -j ACCEPT
+
if [ "$BOCASERVER" != "" ]; then
/sbin/iptables -A INPUT -s $BOCASERVER -j ACCEPT
fi
+if [ "$BOCASERVERS" != "" ]; then
+ for i in `echo $BOCASERVERS | tr ';' ' '`; do
+ /sbin/iptables -A INPUT -s $i -j ACCEPT
+ done
+fi
+/sbin/iptables -A INPUT -m udp -p udp -s 0/0 --sport 67:68 --dport 67:68 -j ACCEPT
+/sbin/iptables -A INPUT -m udp -p udp -s 0/0 --sport 53 --dport 53 -j ACCEPT
+/sbin/iptables -A INPUT -m tcp -p tcp -s 0/0 --sport 53 --dport 53 -j ACCEPT
/sbin/iptables -A INPUT -j REJECT
else
if [ -x /etc/icpc/bocaserver.iptables ]; then
diff --git a/tools/installv2.sh b/tools/installv2.sh
index e75f2e9..5b756da 100755
--- a/tools/installv2.sh
+++ b/tools/installv2.sh
@@ -181,6 +181,15 @@ if [ "`which gconftool`" != "" ]; then
su - icpc -c "gconftool -s -t bool /apps/update-notifier/auto_launch false"
fi
+grep -q icpcadmin /etc/ssh/sshd_config
+if [ "$?" != "0" ]; then
+ echo "DenyUsers icpc icpcadmin" >> /etc/ssh/sshd_config
+ ps auxw |grep sshd|grep -vq grep
+ if [ "$?" == "0" ]; then
+ service ssh reload
+ fi
+fi
+
pass=`echo -n icpc | makepasswd --clearfrom - --crypt-md5 | cut -d'$' -f2-`
pass=\$`echo $pass`
id -u icpc >/dev/null 2>/dev/null