Skip to content

Commit

Permalink
Do not interrupt authentication chain on invalid ldap connection infos
Browse files Browse the repository at this point in the history
Catch LdapExceptions and throw AuthenticationException to not interrupt authentication chain

fixes #7497
  • Loading branch information
majentsch committed Nov 4, 2014
1 parent 18bd49e commit f9fee2d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions library/Icinga/Authentication/Backend/LdapUserBackend.php
Expand Up @@ -68,8 +68,16 @@ protected function createQuery($username)
*/
public function assertAuthenticationPossible()
{
$q = $this->conn->select()->from($this->userClass);
$result = $q->fetchRow();
try {
$q = $this->conn->select()->from($this->userClass);
$result = $q->fetchRow();
} catch (LdapException $e) {
throw new AuthenticationException(
'Connection not possible: %s',
$e->getMessage()
);
}

if (! isset($result)) {
throw new AuthenticationException(
'No objects with objectClass="%s" in DN="%s" found.',
Expand Down Expand Up @@ -158,7 +166,7 @@ public function authenticate(User $user, $password, $healthCheck = true)
} catch (AuthenticationException $e) {
// Authentication not possible
throw new AuthenticationException(
'Authentication against backend "%s" not possible: ',
'Authentication against backend "%s" not possible: %s',
$this->getName(),
$e
);
Expand Down

0 comments on commit f9fee2d

Please sign in to comment.