[server/utils] crypt_password should always return bytes
authorRémi Cardona <remi.cardona@logilab.fr>
Tue, 15 Sep 2015 18:22:41 +0200
changeset 10681 4383f5a30504
parent 10680 1b4df4b3cd9a
child 10682 7e111b606005
[server/utils] crypt_password should always return bytes
server/utils.py
--- a/server/utils.py	Tue Sep 15 18:21:33 2015 +0200
+++ b/server/utils.py	Tue Sep 15 18:22:41 2015 +0200
@@ -64,7 +64,7 @@
     """return the encrypted password using the given salt or a generated one
     """
     if salt is None:
-        return _CRYPTO_CTX.encrypt(passwd)
+        return _CRYPTO_CTX.encrypt(passwd).encode('ascii')
     # empty hash, accept any password for backwards compat
     if salt == '':
         return salt
@@ -74,7 +74,7 @@
     except ValueError: # e.g. couldn't identify hash
         pass
     # wrong password
-    return ''
+    return b''
 
 
 def eschema_eid(cnx, eschema):