From 039a836d4abd0956889aaa4d5cf6f7740a0d2e88 Mon Sep 17 00:00:00 2001 From: Jarkko Lehtoranta Date: Tue, 13 Jun 2017 21:13:40 +0300 Subject: [PATCH] LDAP: Don't handle invalid credentials as a connection error Signed-off-by: Jarkko Lehtoranta --- apps/user_ldap/lib/Connection.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index d0cf87299aa..d3da4f8dadc 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -617,10 +617,17 @@ class Connection extends LDAPUtility { $this->configuration->ldapAgentName, $this->configuration->ldapAgentPassword); if(!$ldapLogin) { + $errno = $this->ldap->errno($cr); + \OCP\Util::writeLog('user_ldap', - 'Bind failed: ' . $this->ldap->errno($cr) . ': ' . $this->ldap->error($cr), + 'Bind failed: ' . $errno . ': ' . $this->ldap->error($cr), \OCP\Util::WARN); - $this->ldapConnectionRes = null; + + // Set to failure mode, if LDAP error code is not LDAP_SUCCESS or LDAP_INVALID_CREDENTIALS + if($errno !== 0x00 && $errno !== 0x31) { + $this->ldapConnectionRes = null; + } + return false; } return true;