- simplification of jail_reval call (references #630)

This commit is contained in:
David COUTADEUR 2014-03-17 12:58:49 +00:00
parent b3d05721a8
commit 262fdaef2c
2 changed files with 5 additions and 5 deletions

View File

@ -278,7 +278,7 @@ sub forgeHeadersInit {
);
$self->safe( $jail->build_safe() );
$forgeHeaders->{$alias} =
$jail->jail_reval( "sub{$sub}", "sub{return($sub)}" );
$jail->jail_reval( $sub );
Lemonldap::NG::Handler::Main::Logger->lmLog(
"$self: Unable to forge headers: $@: sub {$sub}", 'error' )
@ -476,7 +476,7 @@ sub conditionSub {
'customFunctions' => $self->customFunctions
);
$self->safe( $jail->build_safe() );
my $sub = $jail->jail_reval( "sub{return($cond)}", "sub{return($cond)}" );
my $sub = $jail->jail_reval( $cond );
# Return sub and protected flag
return ( $sub, 0 );

View File

@ -117,12 +117,12 @@ sub share_from {
# Build and return restricted eval command with SAFEWRAP, if activated
# @return evaluation of $reval or $reval2
sub jail_reval {
my ( $self, $reval, $reval2 ) = splice @_;
my ( $self, $reval ) = splice @_;
return (
SAFEWRAP
? $self->safe->wrap_code_ref( $self->safe->reval($reval) )
: $self->safe->reval($reval2)
? $self->safe->wrap_code_ref( $self->safe->reval("sub{$reval}") )
: $self->safe->reval("sub{return($reval)}")
);
}