Commit 91228b57 authored by Yadd's avatar Yadd
Browse files

Enable custom functions with safe jail (closes: #956)

parent 59adc7d7
......@@ -46,11 +46,11 @@ sub build_jail {
}
next if ( $self->can($_) );
eval "sub $_ {
my \$r = shift;
my \$uri = Lemonldap::NG::Handler::API->uri_with_args(\$r);
return $sub(\$uri, \$r, \@_)
}";
my \$uri = Lemonldap::NG::Handler::API::${Lemonldap::NG::Handler::API::mode}::uri_with_args();
return $sub(\$uri,\@_)
}";
Lemonldap::NG::Handler::Main::Logger->lmLog( $@, 'error' ) if ($@);
$_ = "&$_";
}
if ( $self->useSafeJail ) {
......@@ -73,7 +73,7 @@ sub build_jail {
&unparsed_uri &args &method &header_in )
]
);
$self->jail->share(@t);
$self->jail->share_from(__PACKAGE__,[@t]);
$self->jail->share_from( 'MIME::Base64', ['&encode_base64'] );
return $self->jail;
......
......@@ -253,7 +253,7 @@ sub headersInit {
$sub .= "'$_' => $val,";
}
$tsv->{forgeHeaders}->{$vhost} = $tsv->{jail}->jail_reval("sub{$sub}");
$tsv->{forgeHeaders}->{$vhost} = $tsv->{jail}->jail_reval("sub{return($sub)}");
Lemonldap::NG::Handler::Main::Logger->lmLog(
"$self: Unable to forge headers: $@: sub {$sub}", 'error' )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment