Просмотр исходного кода

Fix: auth/htpasswd related to detection and use of bcrypt

Peter Bieringer 11 месяцев назад
Родитель
Сommit
2ef99e5e85
4 измененных файлов с 9 добавлено и 4 удалено
  1. 4 0
      CHANGELOG.md
  2. 1 1
      pyproject.toml
  3. 3 2
      radicale/auth/htpasswd.py
  4. 1 1
      setup.py.legacy

+ 4 - 0
CHANGELOG.md

@@ -1,5 +1,9 @@
 # Changelog
 # Changelog
 
 
+## 3.5.1.dev
+
+* Fix: auth/htpasswd related to detection and use of bcrypt
+
 ## 3.5.0
 ## 3.5.0
 
 
 * Add: option [auth] type oauth2 by code migration from https://gitlab.mim-libre.fr/alphabet/radicale_oauth/-/blob/dev/oauth2/
 * Add: option [auth] type oauth2 by code migration from https://gitlab.mim-libre.fr/alphabet/radicale_oauth/-/blob/dev/oauth2/

+ 1 - 1
pyproject.toml

@@ -3,7 +3,7 @@ name = "Radicale"
 # When the version is updated, a new section in the CHANGELOG.md file must be
 # When the version is updated, a new section in the CHANGELOG.md file must be
 # added too.
 # added too.
 readme = "README.md"
 readme = "README.md"
-version = "3.5.0"
+version = "3.5.1.dev"
 authors = [{name = "Guillaume Ayoub", email = "guillaume.ayoub@kozea.fr"}, {name = "Unrud", email = "unrud@outlook.com"}, {name = "Peter Bieringer", email = "pb@bieringer.de"}]
 authors = [{name = "Guillaume Ayoub", email = "guillaume.ayoub@kozea.fr"}, {name = "Unrud", email = "unrud@outlook.com"}, {name = "Peter Bieringer", email = "pb@bieringer.de"}]
 license = {text = "GNU GPL v3"}
 license = {text = "GNU GPL v3"}
 description = "CalDAV and CardDAV Server"
 description = "CalDAV and CardDAV Server"

+ 3 - 2
radicale/auth/htpasswd.py

@@ -113,6 +113,7 @@ class Auth(auth.BaseAuth):
                         "The htpasswd encryption method 'bcrypt' or 'autodetect' requires "
                         "The htpasswd encryption method 'bcrypt' or 'autodetect' requires "
                         "the bcrypt module (entries found: %d)." % self._htpasswd_bcrypt_use) from e
                         "the bcrypt module (entries found: %d)." % self._htpasswd_bcrypt_use) from e
             else:
             else:
+                self._has_bcrypt = True
                 if self._encryption == "autodetect":
                 if self._encryption == "autodetect":
                     if self._htpasswd_bcrypt_use == 0:
                     if self._htpasswd_bcrypt_use == 0:
                         logger.info("auth htpasswd encryption is 'radicale.auth.htpasswd_encryption.%s' and bycrypt module found, but currently not required", self._encryption)
                         logger.info("auth htpasswd encryption is 'radicale.auth.htpasswd_encryption.%s' and bycrypt module found, but currently not required", self._encryption)
@@ -122,8 +123,8 @@ class Auth(auth.BaseAuth):
                 self._verify = functools.partial(self._bcrypt, bcrypt)
                 self._verify = functools.partial(self._bcrypt, bcrypt)
             else:
             else:
                 self._verify = self._autodetect
                 self._verify = self._autodetect
-                self._verify_bcrypt = functools.partial(self._bcrypt, bcrypt)
-            self._has_bcrypt = True
+                if self._htpasswd_bcrypt_use:
+                    self._verify_bcrypt = functools.partial(self._bcrypt, bcrypt)
         else:
         else:
             raise RuntimeError("The htpasswd encryption method %r is not "
             raise RuntimeError("The htpasswd encryption method %r is not "
                                "supported." % self._encryption)
                                "supported." % self._encryption)

+ 1 - 1
setup.py.legacy

@@ -20,7 +20,7 @@ from setuptools import find_packages, setup
 
 
 # When the version is updated, a new section in the CHANGELOG.md file must be
 # When the version is updated, a new section in the CHANGELOG.md file must be
 # added too.
 # added too.
-VERSION = "3.5.0"
+VERSION = "3.5.1.dev"
 
 
 with open("README.md", encoding="utf-8") as f:
 with open("README.md", encoding="utf-8") as f:
     long_description = f.read()
     long_description = f.read()