Change substitution in safe jail (#960)

This commit is contained in:
Xavier Guimard 2016-04-05 20:46:09 +00:00
parent e9c99bd3bb
commit 3290e2bdb9
2 changed files with 3 additions and 6 deletions

View File

@ -17,9 +17,6 @@ has error => ( is => 'rw' );
our $VERSION = '2.0.0';
*datas = *Lemonldap::NG::Handler::Main::SharedVariables::datas;
*tsv = *Lemonldap::NG::Handler::Main::SharedVariables::tsv;
## @imethod protected build_jail()
# Build and return the security jail used to compile rules and headers.
# @return Safe object
@ -72,9 +69,9 @@ sub build_jail {
&unparsed_uri &args &method &header_in )
]
);
$self->jail->share_from( __PACKAGE__,
[ @t, '&tsv', '&datas', '&encrypt' ] );
$self->jail->share_from( __PACKAGE__, [ @t, '&encrypt' ] );
$self->jail->share_from( 'MIME::Base64', ['&encode_base64'] );
$self->jail->share_from( 'Lemonldap::NG::Handler::Main::SharedVariables', [ '$_v' ] );
return $self->jail;
}

View File

@ -532,7 +532,7 @@ sub substitute {
$expr =~ s/\$ip\b/&remote_ip/sg;
# substitute vars with session datas, excepts special vars $_ and $\d+
$expr =~ s/\$(?!ENV)(_*[a-zA-Z]\w*)/datas->{$1}/sg;
$expr =~ s/\$(?!ENV)(_*[a-zA-Z]\w*)/\$_v->{datas}->{$1}/sg;
return $expr;
}