summaryrefslogtreecommitdiff
path: root/passlib/handlers
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2012-04-17 22:23:35 -0400
committerEli Collins <elic@assurancetechnologies.com>2012-04-17 22:23:35 -0400
commite81b32667429c6486a63f4a2c2bf446ba2c8ea90 (patch)
treee553bcda4481228fe2d953729e3fbb1122d44455 /passlib/handlers
parent0cade3487dea5d8117b9f5e045c9fd9425778aec (diff)
downloadpasslib-e81b32667429c6486a63f4a2c2bf446ba2c8ea90.tar.gz
changed bcrypt's os_crypt backend to try alternatives before bailing.
Diffstat (limited to 'passlib/handlers')
-rw-r--r--passlib/handlers/bcrypt.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/passlib/handlers/bcrypt.py b/passlib/handlers/bcrypt.py
index 665a5c9..890c656 100644
--- a/passlib/handlers/bcrypt.py
+++ b/passlib/handlers/bcrypt.py
@@ -249,11 +249,14 @@ class bcrypt(uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.HasManyBackends, uh.
assert hash.startswith(config) and len(hash) == len(config)+31
return hash[-31:]
else:
- # NOTE: not checking other backends since this is lowest priority one,
- # so they probably aren't available either.
- # XXX: though could conceivably use builtin 8|
+ # NOTE: it's unlikely any other backend will be available,
+ # but checking before we bail, just in case.
+ for name in self.backends:
+ if name != "os_crypt" and self.has_backend(name):
+ func = getattr(self, "_calc_checksum_" + name)
+ return func(secret)
raise uh.exc.MissingBackendError(
- "encoded password can't be handled by os_crypt, "
+ "password can't be handled by os_crypt, "
"recommend installing py-bcrypt.",
)