replace deprecated crypt package with crypt-r

This commit is contained in:
adbenitez
2025-01-25 01:00:28 +01:00
committed by l
parent b2995551a2
commit 20f76c83f8
2 changed files with 4 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ dependencies = [
"deltachat-rpc-client", "deltachat-rpc-client",
"filelock", "filelock",
"requests", "requests",
"crypt-r",
] ]
[tool.setuptools] [tool.setuptools]

View File

@@ -1,9 +1,10 @@
import crypt
import json import json
import logging import logging
import os import os
import sys import sys
import crypt_r
from .config import Config, read_config from .config import Config, read_config
from .dictproxy import DictProxy from .dictproxy import DictProxy
from .migrate_db import migrate_from_db_to_maildir from .migrate_db import migrate_from_db_to_maildir
@@ -13,7 +14,7 @@ NOCREATE_FILE = "/etc/chatmail-nocreate"
def encrypt_password(password: str): def encrypt_password(password: str):
# https://doc.dovecot.org/configuration_manual/authentication/password_schemes/ # https://doc.dovecot.org/configuration_manual/authentication/password_schemes/
passhash = crypt.crypt(password, crypt.METHOD_SHA512) passhash = crypt_r.crypt(password, crypt_r.METHOD_SHA512)
return "{SHA512-CRYPT}" + passhash return "{SHA512-CRYPT}" + passhash