[server/utils] catch ValueError from password verification
passlib can raise ValueError when it can't recognized a hash. Treat
that as a wrong password.
--- a/server/utils.py Thu Sep 06 15:03:52 2012 +0200
+++ b/server/utils.py Mon Sep 10 15:08:55 2012 +0200
@@ -64,8 +64,11 @@
# empty hash, accept any password for backwards compat
if salt == '':
return salt
- if _CRYPTO_CTX.verify(passwd, salt):
- return salt
+ try:
+ if _CRYPTO_CTX.verify(passwd, salt):
+ return salt
+ except ValueError: # e.g. couldn't identify hash
+ pass
# wrong password
return ''