Commit ef4f1fb0 authored by Christophe Maudoux's avatar Christophe Maudoux

Fix test submitted user param (#1667)

parent a9fbec3f
......@@ -76,8 +76,10 @@ sub check {
# Use submitted attribute if exists
my $url = $req->param('url') || '';
unless ( $req->param('user') =~ /$self->{conf}->{userControl}/o ) {
return PE_MALFORMEDUSER;
if ( $req->param('user') ) {
unless ( $req->param('user') =~ /$self->{conf}->{userControl}/o ) {
return PE_MALFORMEDUSER;
}
}
if ( $req->param('user') eq $req->{user} or !$req->param('user') ) {
......@@ -89,7 +91,8 @@ sub check {
else {
$self->logger->debug("Check requested for $req->{user}");
$req->{user} = $req->param('user');
$self->userLogger->notice("Retrieve session from userDB and compute Groups & Macros");
$self->userLogger->notice(
"Retrieve session from userDB and compute Groups & Macros");
$attrs = $self->_userDatas($req);
}
......
......@@ -43,9 +43,10 @@ sub init {
sub run {
my ( $self, $req ) = @_;
unless ( $req->param('spoofId') =~ /$self->{conf}->{userControl}/o ) {
return PE_MALFORMEDUSER;
if ( $req->param('spoofId') ) {
unless ( $req->param('spoofId') =~ /$self->{conf}->{userControl}/o ) {
return PE_MALFORMEDUSER;
}
}
my $spoofId = $req->param('spoofId') || '';
......@@ -86,11 +87,11 @@ sub run {
my $sphg = "$self->{conf}->{impersonationPrefix}hGroups";
my $separator = $self->{conf}->{multiValuesSeparator};
$realSession->{$spg} ||= '';
$self->logger->debug("Processing groups...");
my @spoofGrps = my @realGrps = ();
@spoofGrps = split /\Q$separator/, $spoofSession->{groups};
@realGrps = split /\Q$separator/, $realSession->{$spg};
@realGrps = split /\Q$separator/, $realSession->{$spg};
@spoofGrps = ( @spoofGrps, @realGrps );
my %hash = map { $_, 1 } @spoofGrps;
$spoofSession->{groups} = join $separator, sort keys %hash;
......@@ -98,8 +99,8 @@ sub run {
$self->logger->debug("Processing hGroups...");
$spoofSession->{hGroups} ||= {};
$realSession->{$sphg} ||= {};
$spoofSession->{hGroups} = { %{ $spoofSession->{hGroups} },
%{ $realSession->{$sphg} } };
$spoofSession->{hGroups}
= { %{ $spoofSession->{hGroups} }, %{ $realSession->{$sphg} } };
}
# Create spoofed session
......
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