diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2011-12-09 14:59:10 -0500 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2011-12-09 14:59:10 -0500 |
| commit | 1ce29542da310692c68dcbe7f21928d2d12276ba (patch) | |
| tree | c709a2791f25b6f7d24b6b19de3d0764b5a4cfab /passlib/utils | |
| parent | 038b57325743dddbaf37c57adfa7979efb6b0bb7 (diff) | |
| download | passlib-1ce29542da310692c68dcbe7f21928d2d12276ba.tar.gz | |
was browsing Python's source, and noticed crypt() might sometimes return None --
Diffstat (limited to 'passlib/utils')
| -rw-r--r-- | passlib/utils/__init__.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/passlib/utils/__init__.py b/passlib/utils/__init__.py index a08cacb..fbdda9d 100644 --- a/passlib/utils/__init__.py +++ b/passlib/utils/__init__.py @@ -199,7 +199,11 @@ else: raise TypeError("hash must be unicode") else: hash = hash.encode("utf-8") - return True, os_crypt(secret, hash).decode("ascii") + result = os_crypt(secret, hash) + if result is None: + return False, None + else: + return True, result.decode("ascii") # Py3k # #if isinstance(secret, bytes): @@ -217,7 +221,8 @@ else: # #not sure if/how this could happen, but being paranoid. # warn("utf-8 password didn't re-encode correctly") # return False, None - #return True, os_crypt(secret, hash) + #result = os_crypt(secret, hash) + #return (result is not None), result # end Py3k # #================================================================================= |
