diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2011-07-09 12:28:59 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2011-07-09 12:28:59 -0400 |
commit | 5c1bbb6f4fe1902a554f24e665b6e23ba63ba9de (patch) | |
tree | b5256bb46aaf386019ba6eb9456584acd4608938 /passlib/handlers/des_crypt.py | |
parent | 1ad4449dd053d5c19a7a9d432f556c34cd062971 (diff) | |
download | passlib-5c1bbb6f4fe1902a554f24e665b6e23ba63ba9de.tar.gz |
bugfixes from running UTs
* typo in safe_os_crypt UT
* typo in has_backend UT
* typo in HasManyBackends HandlerCase UT
* fixed inverted has_backend() test in HasManyBackends.set_backend()
* ensure all safe_os_crypt backend checks return boolean
* BSDiCrypt - fixed os_crypt backend, was passing incomplete string to os_crypt
* workaround for Jython object.__new__() behavior in test 'UnsaltedHash' UT
* added passlib.utils.jython_vm flag for detecting jython
Diffstat (limited to 'passlib/handlers/des_crypt.py')
-rw-r--r-- | passlib/handlers/des_crypt.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/passlib/handlers/des_crypt.py b/passlib/handlers/des_crypt.py index 0cbe7a8..ca095c3 100644 --- a/passlib/handlers/des_crypt.py +++ b/passlib/handlers/des_crypt.py @@ -205,7 +205,8 @@ class des_crypt(uh.HasManyBackends, uh.HasSalt, uh.GenericHandler): @classproperty def _has_backend_os_crypt(cls): - return safe_os_crypt and safe_os_crypt(u"test", u"ab")[1] == u'abgOeLfPimXQo' + h = u'abgOeLfPimXQo' + return bool(safe_os_crypt and safe_os_crypt(u"test",h)[1]==h) def _calc_checksum_builtin(self, secret): #gotta do something - no official policy since des-crypt predates unicode @@ -334,15 +335,15 @@ class bsdi_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler @classproperty def _has_backend_os_crypt(cls): h = u'_/...lLDAxARksGCHin.' - return safe_os_crypt and safe_os_crypt(u"test", h)[1] == h - + return bool(safe_os_crypt and safe_os_crypt(u"test",h)[1]==h) + def _calc_checksum_builtin(self, secret): if isinstance(secret, unicode): secret = secret.encode("utf-8") return raw_ext_crypt(secret, self.rounds, self.salt.encode("ascii")).decode("ascii") def _calc_checksum_os_crypt(self, secret): - ok, hash = safe_os_crypt(secret, self.salt) + ok, hash = safe_os_crypt(secret, self.to_string(native=False)) if ok: return hash[9:] else: |