diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2012-04-12 21:52:26 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2012-04-12 21:52:26 -0400 |
commit | c0f420bf7d7659ee110432f7cbb0233554dfd32a (patch) | |
tree | d8416c7cd9b5f5d54e5fcb58fafa02f64da07352 /passlib/handlers/md5_crypt.py | |
parent | e71ddce83853566311effebf68b9bbbdebf4c2ab (diff) | |
download | passlib-c0f420bf7d7659ee110432f7cbb0233554dfd32a.tar.gz |
assorted bugfixes, tweaks, and tests added; based on coverage examination
* test os_crypt backend has functional fallback
* test handler methods accept all unicode/bytes combinations for secret & hash
* fixed some incorrect error messages & types being caught & raised
* other minor cleanups
Diffstat (limited to 'passlib/handlers/md5_crypt.py')
-rw-r--r-- | passlib/handlers/md5_crypt.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/passlib/handlers/md5_crypt.py b/passlib/handlers/md5_crypt.py index 9441bbc..c963155 100644 --- a/passlib/handlers/md5_crypt.py +++ b/passlib/handlers/md5_crypt.py @@ -68,14 +68,13 @@ def _raw_md5_crypt(pwd, salt, use_apr=False): #===================================================================== #validate secret + # XXX: not sure what official unicode policy is, using this as default if isinstance(pwd, unicode): - # XXX: not sure what official unicode policy is, using this as default pwd = pwd.encode("utf-8") - elif not isinstance(pwd, bytes): - raise TypeError("password must be bytes or unicode") + assert isinstance(pwd, bytes), "pwd not unicode or bytes" pwd_len = len(pwd) - #validate salt + #validate salt - should have been taken care of by caller assert isinstance(salt, unicode), "salt not unicode" salt = salt.encode("ascii") assert len(salt) < 9, "salt too large" |