server/ldaputils.py
changeset 8695 358d8bed9626
parent 8683 d537786e52b8
child 8905 c8fc3e3b46e4
equal deleted inserted replaced
8694:d901c36bcfce 8695:358d8bed9626
   210             # no such user
   210             # no such user
   211             raise AuthenticationError()
   211             raise AuthenticationError()
   212         # check password by establishing a (unused) connection
   212         # check password by establishing a (unused) connection
   213         try:
   213         try:
   214             self._connect(user, password)
   214             self._connect(user, password)
   215         except ldap.LDAPError, ex:
   215         except ldap.LDAPError as ex:
   216             # Something went wrong, most likely bad credentials
   216             # Something went wrong, most likely bad credentials
   217             self.info('while trying to authenticate %s: %s', user, ex)
   217             self.info('while trying to authenticate %s: %s', user, ex)
   218             raise AuthenticationError()
   218             raise AuthenticationError()
   219         except Exception:
   219         except Exception:
   220             self.error('while trying to authenticate %s', user, exc_info=True)
   220             self.error('while trying to authenticate %s', user, exc_info=True)
   303             res = cnx.result(all=0)[1]
   303             res = cnx.result(all=0)[1]
   304         except ldap.NO_SUCH_OBJECT:
   304         except ldap.NO_SUCH_OBJECT:
   305             self.info('ldap NO SUCH OBJECT %s %s %s', base, scope, searchstr)
   305             self.info('ldap NO SUCH OBJECT %s %s %s', base, scope, searchstr)
   306             self._process_no_such_object(session, base)
   306             self._process_no_such_object(session, base)
   307             return []
   307             return []
   308         # except ldap.REFERRAL, e:
   308         # except ldap.REFERRAL as e:
   309         #     cnx = self.handle_referral(e)
   309         #     cnx = self.handle_referral(e)
   310         #     try:
   310         #     try:
   311         #         res = cnx.search_s(base, scope, searchstr, attrs)
   311         #         res = cnx.search_s(base, scope, searchstr, attrs)
   312         #     except ldap.PARTIAL_RESULTS:
   312         #     except ldap.PARTIAL_RESULTS:
   313         #         res_type, res = cnx.result(all=0)
   313         #         res_type, res = cnx.result(all=0)