From c42c7977bef5f8e2bdb844fa7a7739733e963ad1 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Wed, 11 Jun 2014 15:04:19 +0200 Subject: [PATCH] Call extended backend health checks when creating ldap authentication backends fixes #6457 --- application/forms/Config/Authentication/LdapBackendForm.php | 3 +++ library/Icinga/Authentication/Backend/LdapUserBackend.php | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/application/forms/Config/Authentication/LdapBackendForm.php b/application/forms/Config/Authentication/LdapBackendForm.php index 966cea1cc..051b3c0c0 100644 --- a/application/forms/Config/Authentication/LdapBackendForm.php +++ b/application/forms/Config/Authentication/LdapBackendForm.php @@ -179,9 +179,12 @@ class LdapBackendForm extends BaseBackendForm $backendConfig->user_class, $backendConfig->user_name_attribute ); + $testConn->assertAuthenticationPossible(); + /* if ($testConn->count() === 0) { throw new Exception('No Users Found On Directory Server'); } + */ } catch (Exception $exc) { $this->addErrorMessage( t('Connection Validation Failed: ' . $exc->getMessage()) diff --git a/library/Icinga/Authentication/Backend/LdapUserBackend.php b/library/Icinga/Authentication/Backend/LdapUserBackend.php index 37216fdd5..d19437ae6 100644 --- a/library/Icinga/Authentication/Backend/LdapUserBackend.php +++ b/library/Icinga/Authentication/Backend/LdapUserBackend.php @@ -87,15 +87,15 @@ class LdapUserBackend extends UserBackend * * @throws AuthenticationException When authentication is not possible */ - protected function assertAuthenticationPossible() + public function assertAuthenticationPossible() { $q = $this->conn->select()->from($this->userClass); $result = $q->fetchRow(); if (!isset($result)) { throw new AuthenticationException( - sprintf('No users with objectClass="%s" in DN="%s" available', + sprintf('No objects with objectClass="%s" in DN="%s" found.', $this->userClass, - $this->userNameAttribute + $this->conn->getDN() )); }