With Python 3.9, the crypt function raises an OSError

See https://bugs.python.org/issue39289

Signed-off-by: Yohann D'ANELLO <ynerant@¢rans.org>
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2020-12-22 23:07:33 +01:00
parent 802fef95fa
commit 10b389e7be
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -409,7 +409,10 @@ def crypt_salt_is_valid(salt):
if '$' not in salt[1:]:
return False
else:
try:
hashed = crypt.crypt("", salt)
except OSError:
return False
if not hashed or '$' not in hashed[1:]:
return False
else: