App-EvalServer

 view release on metacpan or  search on metacpan

lib/App/EvalServer/Child.pm  view on Meta::CPAN

  $App::EvalServer::Child::AUTHORITY = 'cpan:HINRIK';
}
BEGIN {
  $App::EvalServer::Child::VERSION = '0.08';
}

use strict;
use warnings FATAL => 'all';
use BSD::Resource;
use POE::Filter::Reference;
use POSIX qw<setgid>;

# we need to load these here, otherwise they'll be loaded on demand
# after the chroot, which will fail
getrusage();
use Carp::Heavy;
use Storable 'nfreeze'; nfreeze([]);
use File::Glob;

my $PIPE;
my $FILTER;

lib/App/EvalServer/Child.pm  view on Meta::CPAN


    _fail("Not root, can't chroot or take other precautions, dying") if $< != 0;

    chdir or _fail("Failed to chdir into $jail: $!");
    chroot '.' or _fail("Failed to chroot into $jail: $!");

    # drop root privileges
    $)="$new_uid $new_uid";
    $(=$new_uid;
    $<=$>=$new_uid;
    setgid($new_uid); #We just assume the uid is the same as the gid. Hot.

    if ($> != $new_uid || $< != $new_uid) {
        _fail("Failed to drop root privileges");
    }

    my $kilo = 1024;
    my $meg = $kilo * $kilo;
    my $limit_bytes = $limit * $meg;

    (



( run in 0.564 second using v1.01-cache-2.11-cpan-ceb78f64989 )