Skip to content

Commit

Permalink
Add _crypt member back to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirVondukr committed Sep 12, 2024
1 parent 981a4b8 commit bc6ee1c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion passlib/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,11 +763,15 @@ def is_safe_crypt_input(value):

try:
import legacycrypt

_crypt = legacycrypt.crypt
except ImportError:
# ImportError: libcrypt / libxcrypt missing

def safe_crypt(secret, hash):
return None

_crypt = None
has_crypt = False
else:
has_crypt = True
Expand All @@ -791,7 +795,7 @@ def safe_crypt(secret, hash):
hash = hash.decode("ascii")
try:
with _safe_crypt_lock:
result = legacycrypt.crypt(secret, hash)
result = _crypt(secret, hash)
except OSError:
# new in py39 -- per https://bugs.python.org/issue39289,
# crypt() now throws OSError for various things, mainly unknown hash formats
Expand Down

0 comments on commit bc6ee1c

Please sign in to comment.