Index: Makefile =================================================================== --- Makefile (revision 536360) +++ Makefile (working copy) @@ -3,6 +3,7 @@ PORTNAME= passlib PORTVERSION= 1.7.2 +PORTREVISION= 1 CATEGORIES= security python MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} Index: files/patch-2d0a7940 =================================================================== --- files/patch-2d0a7940 (nonexistent) +++ files/patch-2d0a7940 (working copy) @@ -0,0 +1,63 @@ +# :class:`bcrypt`: OS native backend wasn't being detected under Python 3 on BSD platforms. +# This was due to an internal issue in feature-detection code, which has been fixed. +# https://foss.heptapod.net/python-libs/passlib/commit/2d0a79401a2c454c666607d261ad64f44569ed9f + +diff --git a/passlib/handlers/bcrypt.py b/passlib/handlers/bcrypt.py +index 73fbc21aa1b01f349a40384b1d62654e099ea26a..e54a085a7ba9aa394c88a7cf768cb2801a069148 100644 +--- passlib/handlers/bcrypt.py ++++ passlib/handlers/bcrypt.py +@@ -49,7 +49,7 @@ IDENT_2B = u("$2b$") + _BNULL = b'\x00' + + # reference hash of "test", used in various self-checks +-TEST_HASH_2A = b"$2a$04$5BJqKfqMQvV7nS.yUguNcueVirQqDBGaLXSqj.rs.pZPlNR0UX/HK" ++TEST_HASH_2A = "$2a$04$5BJqKfqMQvV7nS.yUguNcueVirQqDBGaLXSqj.rs.pZPlNR0UX/HK" + + def _detect_pybcrypt(): + """ +@@ -408,7 +408,7 @@ class _BcryptCommon(uh.SubclassBackendMixin, uh.TruncateMixin, uh.HasManyIdents, + #---------------------------------------------------------------- + # check for 2y support + #---------------------------------------------------------------- +- test_hash_2y = TEST_HASH_2A.replace(b"2a", b"2y") ++ test_hash_2y = TEST_HASH_2A.replace("2a", "2y") + result = safe_verify("test", test_hash_2y) + if not result: + raise RuntimeError("%s incorrectly rejected $2y$ hash" % backend) +@@ -428,7 +428,7 @@ class _BcryptCommon(uh.SubclassBackendMixin, uh.TruncateMixin, uh.HasManyIdents, + #---------------------------------------------------------------- + # check for 2b support + #---------------------------------------------------------------- +- test_hash_2b = TEST_HASH_2A.replace(b"2a", b"2b") ++ test_hash_2b = TEST_HASH_2A.replace("2a", "2b") + result = safe_verify("test", test_hash_2b) + if not result: + raise RuntimeError("%s incorrectly rejected $2b$ hash" % backend) +diff --git a/passlib/utils/__init__.py b/passlib/utils/__init__.py +index ba54b2fb89d0533b32621408554b12ce38496da0..b9fad4d8ccb726fa1283ddbe87608710fe18a8e7 100644 +--- passlib/utils/__init__.py ++++ passlib/utils/__init__.py +@@ -59,7 +59,7 @@ from passlib.exc import ExpectedStringError + from passlib.utils.compat import (add_doc, join_bytes, join_byte_values, + join_byte_elems, irange, imap, PY3, u, + join_unicode, unicode, byte_elem_value, nextgetter, +- unicode_or_bytes_types, ++ unicode_or_str, unicode_or_bytes_types, + get_method_function, suppress_cause) + # local + __all__ = [ +@@ -860,7 +860,13 @@ def test_crypt(secret, hash): + :arg hash: known hash of password to use as reference + :returns: True or False + """ +- assert secret and hash ++ # safe_crypt() always returns unicode, which means that for py3, ++ # 'hash' can't be bytes, or "== hash" will never be True. ++ # under py2 unicode & str(bytes) will compare fine; ++ # so just enforcing "unicode_or_str" limitation ++ assert isinstance(hash, unicode_or_str), \ ++ "hash must be unicode_or_str, got %s" % type(hash) ++ assert hash, "hash must be non-empty" + return safe_crypt(secret, hash) == hash + + timer = timeit.default_timer