From c26685a4df29c47e7be411e71e8dffcb59ccb11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Wed, 6 Mar 2024 16:47:16 +0100 Subject: [PATCH] fix(user_ldap): Early failure for empty password login attempt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids user_ldap logging about an invalid configuration with an empty password when the empty password actually comes from a login attempt. Signed-off-by: Côme Chilliet --- apps/user_ldap/lib/Access.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index e608d5f80f029..b6c5386fe6263 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -1593,17 +1593,15 @@ public function getFilterForUserCount(): string { return $filter; } - /** - * @param string $name - * @param string $password - * @return bool - */ - public function areCredentialsValid($name, $password) { + public function areCredentialsValid(string $name, string $password): bool { + if ($name === '' || $password === '') { + return false; + } $name = $this->helper->DNasBaseParameter($name); $testConnection = clone $this->connection; $credentials = [ 'ldapAgentName' => $name, - 'ldapAgentPassword' => $password + 'ldapAgentPassword' => $password, ]; if (!$testConnection->setConfiguration($credentials)) { return false;