From 05ea37d694810b2e92b9522104dfacf32cebc26e Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 8 Dec 2023 09:17:56 +0100 Subject: [PATCH] lazy-load crypt which is a deprecated lib to avoid having DepreciationWarnings all over the place --- src/user.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/user.py b/src/user.py index 40274952f..46228805f 100644 --- a/src/user.py +++ b/src/user.py @@ -20,7 +20,6 @@ import os import re import pwd import grp -import crypt import random import string import subprocess @@ -1453,6 +1452,9 @@ def _hash_user_password(password): [3] https://www.safaribooksonline.com/library/view/practical-unix-and/0596003234/ch04s03.html """ + # FIXME: 'crypt' is deprecated and slated for removal in Python 3.13 + import crypt + char_set = string.ascii_uppercase + string.ascii_lowercase + string.digits + "./" salt = "".join([random.SystemRandom().choice(char_set) for x in range(16)])