server/sources/ldapuser.py
branchstable
changeset 5836 e654c13b57b8
parent 5827 aad4496a279a
child 5855 db59080f1c8d
equal deleted inserted replaced
5835:4125a8021956 5836:e654c13b57b8
   291         except IndexError:
   291         except IndexError:
   292             # no such user
   292             # no such user
   293             raise AuthenticationError()
   293             raise AuthenticationError()
   294         # check password by establishing a (unused) connection
   294         # check password by establishing a (unused) connection
   295         try:
   295         try:
   296             self._connect(user, password)
   296             if password:
       
   297                 self._connect(user, password)
       
   298             else:
       
   299                 # On Windows + ADAM this would have succeeded (!!!)
       
   300                 # You get Authenticated as: 'NT AUTHORITY\ANONYMOUS LOGON'.
       
   301                 # we really really don't want that
       
   302                 raise Exception('No password provided')
   297         except Exception, ex:
   303         except Exception, ex:
   298             self.info('while trying to authenticate %s: %s', user, ex)
   304             self.info('while trying to authenticate %s: %s', user, ex)
   299             # Something went wrong, most likely bad credentials
   305             # Something went wrong, most likely bad credentials
   300             raise AuthenticationError()
   306             raise AuthenticationError()
   301         return self.extid2eid(user['dn'], 'CWUser', session)
   307         return self.extid2eid(user['dn'], 'CWUser', session)