# HG changeset patch # User Sylvain Thénault # Date 1278054599 -7200 # Node ID a021295083788a04d245c3eaa126e04be26358de # Parent db59080f1c8d5645d9a5d3c6269a67af415e9c4c [ldap] fix exception handling on authentication error diff -r db59080f1c8d -r a02129508378 server/sources/ldapuser.py --- a/server/sources/ldapuser.py Fri Jul 02 09:05:56 2010 +0200 +++ b/server/sources/ldapuser.py Fri Jul 02 09:09:59 2010 +0200 @@ -19,8 +19,6 @@ this source is for now limited to a read-only CWUser source - - Part of the code is coming form Zope's LDAPUserFolder Copyright (c) 2004 Jens Vagelpohl. @@ -297,10 +295,12 @@ # check password by establishing a (unused) connection try: self._connect(user, password) + except ldap.LDAPError, ex: + # Something went wrong, most likely bad credentials + self.info('while trying to authenticate %s: %s', user, ex) + raise AuthenticationError() except Exception: - self.error('while trying to authenticate %s: %s', user, - exc_info=True) - # Something went wrong, most likely bad credentials + self.error('while trying to authenticate %s', user, exc_info=True) raise AuthenticationError() return self.extid2eid(user['dn'], 'CWUser', session)