server/sources/native.py
branchstable
changeset 8235 c2a91d6639d8
parent 8205 14c52c5ee706
child 8265 9747ab9230ad
child 8317 9c59258e7798
equal deleted inserted replaced
8234:83fd9ff90a9d 8235:c2a91d6639d8
  1584             rset = self.source.syntax_tree_search(session, self._passwd_rqlst, args)
  1584             rset = self.source.syntax_tree_search(session, self._passwd_rqlst, args)
  1585             try:
  1585             try:
  1586                 pwd = rset[0][0]
  1586                 pwd = rset[0][0]
  1587             except IndexError:
  1587             except IndexError:
  1588                 raise AuthenticationError('bad login')
  1588                 raise AuthenticationError('bad login')
       
  1589             if pwd is None:
       
  1590                 # if pwd is None but a password is provided, something is wrong
       
  1591                 raise AuthenticationError('bad password')
  1589             # passwords are stored using the Bytes type, so we get a StringIO
  1592             # passwords are stored using the Bytes type, so we get a StringIO
  1590             if pwd is not None:
  1593             args['pwd'] = Binary(crypt_password(password, pwd.getvalue()[:2]))
  1591                 args['pwd'] = Binary(crypt_password(password, pwd.getvalue()[:2]))
       
  1592         # get eid from login and (crypted) password
  1594         # get eid from login and (crypted) password
  1593         rset = self.source.syntax_tree_search(session, self._auth_rqlst, args)
  1595         rset = self.source.syntax_tree_search(session, self._auth_rqlst, args)
  1594         try:
  1596         try:
  1595             return rset[0][0]
  1597             return rset[0][0]
  1596         except IndexError:
  1598         except IndexError: