1
0

6 Commits

Author SHA256 Message Date
8b95fc4648 Accepting request 1309714 from devel:languages:python
- Add patch support-bcrypt-5.0.patch:
  * Support changes required by bcrypt 5.0.

OBS-URL: https://build.opensuse.org/request/show/1309714
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-passlib?expand=0&rev=31
2025-10-08 16:12:48 +00:00
3f0b6c7fd9 - Add patch support-bcrypt-5.0.patch:
* Support changes required by bcrypt 5.0.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-passlib?expand=0&rev=59
2025-10-08 01:42:10 +00:00
e503c6cbd8 Accepting request 1207026 from devel:languages:python
- Add patch no-crypt-with-python-313.patch:
  * Do not run tests requiring 'crypt' with Python 3.13.

OBS-URL: https://build.opensuse.org/request/show/1207026
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-passlib?expand=0&rev=30
2024-10-12 11:24:42 +00:00
090ebd628b - Add patch no-crypt-with-python-313.patch:
* Do not run tests requiring 'crypt' with Python 3.13.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-passlib?expand=0&rev=57
2024-10-11 04:35:52 +00:00
2c862d14e1 Accepting request 1203877 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1203877
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-passlib?expand=0&rev=29
2024-09-29 16:09:05 +00:00
64231465ec - Only run the full testsuite in openSUSE
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-passlib?expand=0&rev=55
2024-09-26 12:09:18 +00:00
4 changed files with 83 additions and 3 deletions

View File

@@ -0,0 +1,15 @@
Index: passlib-1.7.4/passlib/tests/utils.py
===================================================================
--- passlib-1.7.4.orig/passlib/tests/utils.py
+++ passlib-1.7.4/passlib/tests/utils.py
@@ -3360,6 +3360,10 @@ class OsCryptMixin(HandlerCase):
if hasattr(self.handler, "orig_prefix"):
raise self.skipTest("not applicable to wrappers")
+ # crypt module removed in Python 3.13
+ if sys.version_info[:2] >= (3, 13):
+ raise self.skipTest("no crypt module with Python 3.13")
+
# look for first entry that matches current system
# XXX: append "/" + platform.release() to string?
# XXX: probably should rework to support rows being dicts w/ "minver" / "maxver" keys,

View File

@@ -1,3 +1,20 @@
-------------------------------------------------------------------
Wed Oct 8 01:41:11 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-bcrypt-5.0.patch:
* Support changes required by bcrypt 5.0.
-------------------------------------------------------------------
Fri Oct 11 04:34:50 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch no-crypt-with-python-313.patch:
* Do not run tests requiring 'crypt' with Python 3.13.
-------------------------------------------------------------------
Thu Sep 26 10:44:49 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Only run the full testsuite in openSUSE
-------------------------------------------------------------------
Thu Aug 3 06:29:11 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file
# spec file for package python-passlib
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -36,6 +36,10 @@ URL: https://foss.heptapod.net/python-libs/passlib
Source: https://files.pythonhosted.org/packages/source/p/passlib/passlib-%{version}.tar.gz
# PATCH-FIX-OPENSUSE Posted to https://foss.heptapod.net/python-libs/passlib/-/issues/185
Patch0: no-pkg_resources.patch
# PATCH-FIX-OPENSUSE Skip crypt tests under Python 3.13
Patch1: no-crypt-with-python-313.patch
# PATCH-FIX-OPENSUSE Support bcrypt 5.0+ changes https://foss.heptapod.net/python-libs/passlib/-/issues/196
Patch2: support-bcrypt-5.0.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
@@ -46,7 +50,7 @@ BuildRequires: %{python_module argon2_cffi}
BuildRequires: %{python_module bcrypt}
BuildRequires: %{python_module cryptography}
BuildRequires: %{python_module pytest}
%if 0%{?suse_version} >= 1550 || 0%{?is_opensuse}
%if 0%{?is_opensuse}
BuildRequires: %{python_module Django}
BuildRequires: %{python_module scrypt}
%endif

44
support-bcrypt-5.0.patch Normal file
View File

@@ -0,0 +1,44 @@
Index: passlib-1.7.4/passlib/handlers/bcrypt.py
===================================================================
--- passlib-1.7.4.orig/passlib/handlers/bcrypt.py
+++ passlib-1.7.4/passlib/handlers/bcrypt.py
@@ -652,6 +652,9 @@ class _BcryptBackend(_BcryptCommon):
config = self._get_config(ident)
if isinstance(config, unicode):
config = config.encode("ascii")
+ # bcrypt 5.0 and above require secret to 72 bytes or less
+ if len(secret) > 72:
+ secret = secret[:72]
hash = _bcrypt.hashpw(secret, config)
assert isinstance(hash, bytes)
if not hash.startswith(config) or len(hash) != len(config)+31:
Index: passlib-1.7.4/passlib/tests/test_handlers_bcrypt.py
===================================================================
--- passlib-1.7.4.orig/passlib/tests/test_handlers_bcrypt.py
+++ passlib-1.7.4/passlib/tests/test_handlers_bcrypt.py
@@ -13,7 +13,7 @@ from passlib import hash
from passlib.handlers.bcrypt import IDENT_2, IDENT_2X
from passlib.utils import repeat_string, to_bytes, is_safe_crypt_input
from passlib.utils.compat import irange, PY3
-from passlib.tests.utils import HandlerCase, TEST_MODE
+from passlib.tests.utils import HandlerCase, SkipTest, TEST_MODE
from passlib.tests.test_handlers import UPASS_TABLE
# module
@@ -193,6 +193,16 @@ class _bcrypt_test(HandlerCase):
#===================================================================
# fuzz testing
#===================================================================
+ def test_77_fuzz_input(self, threaded=False):
+ try:
+ import bcrypt
+ except ImportError:
+ return
+ bcrypt_version = tuple([int(x) for x in bcrypt.__version__.split('.')])
+ if bcrypt_version >= (5, 0, 0):
+ raise SkipTest("requires bcrypt < 5.0")
+ super().test_77_fuzz_input(threaded=threaded)
+
def crypt_supports_variant(self, hash):
"""check if OS crypt is expected to support given ident"""
from passlib.handlers.bcrypt import bcrypt, IDENT_2X, IDENT_2Y