From: Jan Schneider Date: Mon, 20 Sep 2010 09:22:35 +0000 (+0200) Subject: Properly catch and re-throw bind errors from Horde_Ldap. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=d579c76e9042c701a42bb22b5545a8e1f0118612;p=horde.git Properly catch and re-throw bind errors from Horde_Ldap. --- diff --git a/framework/Auth/lib/Horde/Auth/Ldap.php b/framework/Auth/lib/Horde/Auth/Ldap.php index 97c3946e9..d8dce3ef7 100644 --- a/framework/Auth/lib/Horde/Auth/Ldap.php +++ b/framework/Auth/lib/Horde/Auth/Ldap.php @@ -218,13 +218,13 @@ class Horde_Auth_Ldap extends Horde_Auth_Base $dn = $this->_findDN($userId); /* Attempt to bind to the LDAP server as the user. */ - $bind = clone $this->_ldap; try { - if (!$bind->bind($dn, $credentials['password'])) { - throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); - } + $this->_ldap->bind($dn, $credentials['password']); } catch (Horde_Ldap_Exception $e) { - throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED); + if (Horde_Ldap::errorName($e->getCode() == 'LDAP_INVALID_CREDENTIALS')) { + throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN); + } + throw new Horde_Auth_Exception($e->getMessage(), Horde_Auth::REASON_MESSAGE); } if ($this->_params['password_expiration'] == 'yes') {