Make sure work directory is world-searchable
[gruntmaster-daemon.git] / lib / Gruntmaster / Daemon.pm
index 64f8231..1e5d8b2 100644 (file)
@@ -33,8 +33,6 @@ use constant FORMAT_EXTENSION => {
 
 ##################################################
 
-sub purge;
-
 my $db;
 
 sub safe_can_nodie {
@@ -143,13 +141,7 @@ sub process{
                problem => $jobr->problem,
                owner   => $jobr->owner,
                job     => $jobr->id,
-               solved  => $solved});
-
-       purge '/log/';
-       purge "/log/$job";
-       purge '/st/' . $jobr->contest if $jobr->contest;
-       purge '/us/';
-       purge '/us/' . $jobr->owner;
+               solved  => $solved}) if !$jobr->problem->private;
 }
 
 sub got_job{
@@ -169,12 +161,13 @@ sub got_job{
 }
 
 sub run{
-       warn "No GRUNTMASTER_VM environment variable. Running without a VM is a security risk.\n"  unless $ENV{GRUNTMASTER_VM};
        require Gruntmaster::Data;
-       $db = Gruntmaster::Data->connect('dbi:Pg:');
+       $db = Gruntmaster::Data->connect($ENV{GRUNTMASTER_DSN} // 'dbi:Pg:');
        Log::Log4perl->init('/etc/gruntmasterd/gruntmasterd-log.conf');
        get_logger->info("gruntmasterd $VERSION started");
-       chdir tempdir 'gruntmasterd.XXXX', CLEANUP => 1, TMPDIR => 1;
+       my $dir = tempdir 'gruntmasterd.XXXX', CLEANUP => 1, TMPDIR => 1;
+       chmod 0711, $dir;
+       chdir $dir;
        while (1) {
                my $job = $db->jobs->search({daemon => undef}, {rows => 1})->first;
                got_job $job if defined $job;
This page took 0.023995 seconds and 4 git commands to generate.