server/sources/native.py
branchstable
changeset 8235 c2a91d6639d8
parent 8205 14c52c5ee706
child 8265 9747ab9230ad
child 8317 9c59258e7798
--- a/server/sources/native.py	Tue Feb 14 15:15:59 2012 +0100
+++ b/server/sources/native.py	Mon Feb 13 17:57:07 2012 +0100
@@ -1586,9 +1586,11 @@
                 pwd = rset[0][0]
             except IndexError:
                 raise AuthenticationError('bad login')
+            if pwd is None:
+                # if pwd is None but a password is provided, something is wrong
+                raise AuthenticationError('bad password')
             # passwords are stored using the Bytes type, so we get a StringIO
-            if pwd is not None:
-                args['pwd'] = Binary(crypt_password(password, pwd.getvalue()[:2]))
+            args['pwd'] = Binary(crypt_password(password, pwd.getvalue()[:2]))
         # get eid from login and (crypted) password
         rset = self.source.syntax_tree_search(session, self._auth_rqlst, args)
         try: