Fix bad call in LDAP (#1805)

This commit is contained in:
Xavier 2019-06-17 19:21:48 +02:00
parent 862116245d
commit aff7527580

View File

@ -41,7 +41,18 @@ sub authenticate {
# Set the dn unless done before
unless ( $req->data->{dn} ) {
if ( my $tmp = $self->getUser($req) ) {
my $class = ref $self;
$class =~ s/::Auth::/::UserDB::/;
$class->logger->warn(
'Auth::LDAP used without UserDB::LDAP, LLNG may fail');
my $tmp = eval { $self->p->loadedModules->{$class}->getUser($req) };
if ($@) {
$self->logger->error(
"Unable to authenticate using Auth::LDAP without having a UserDB::LDAP search: $@"
);
return PE_ERROR;
}
if ($tmp) {
$self->setSecurity($req);
return $tmp;
}