summaryrefslogtreecommitdiff
path: root/dev-python/passlib/files
diff options
context:
space:
mode:
authorPalica <palica+gitlab@liguros.net>2020-06-23 22:35:08 +0200
committerPalica <palica+gitlab@liguros.net>2020-06-23 22:35:08 +0200
commitecdac123787b96ce6649f0f91da12ea6458cc2b1 (patch)
treeb89c74d9e6fe6e8aebc4c77bcbeb4ab73214127d /dev-python/passlib/files
parent1be72aa41cf41dedadeecf59dca9f01de6381f5e (diff)
downloadbaldeagleos-repo-ecdac123787b96ce6649f0f91da12ea6458cc2b1.tar.gz
baldeagleos-repo-ecdac123787b96ce6649f0f91da12ea6458cc2b1.tar.xz
baldeagleos-repo-ecdac123787b96ce6649f0f91da12ea6458cc2b1.zip
Updating liguros repo
Diffstat (limited to 'dev-python/passlib/files')
-rw-r--r--dev-python/passlib/files/passlib-1.7.2-py39.patch19
-rw-r--r--dev-python/passlib/files/passlib-1.7.2-pypy3.patch65
2 files changed, 84 insertions, 0 deletions
diff --git a/dev-python/passlib/files/passlib-1.7.2-py39.patch b/dev-python/passlib/files/passlib-1.7.2-py39.patch
new file mode 100644
index 000000000000..c5dbc208a88b
--- /dev/null
+++ b/dev-python/passlib/files/passlib-1.7.2-py39.patch
@@ -0,0 +1,19 @@
+diff --git a/passlib/utils/__init__.py b/passlib/utils/__init__.py
+index 69b55e5..d18ec50 100644
+--- a/passlib/utils/__init__.py
++++ b/passlib/utils/__init__.py
+@@ -807,7 +807,13 @@ else:
+
+ if isinstance(hash, bytes):
+ hash = hash.decode("ascii")
+- result = _crypt(secret, hash)
++ try:
++ result = _crypt(secret, hash)
++ except OSError:
++ # new in py39 -- per https://bugs.python.org/issue39289,
++ # crypt() now throws OSError for various things, mainly unknown hash formats
++ # translating that to None for now (may revise safe_crypt behavior in future)
++ return None
+ if PYPY and isinstance(result, bytes):
+ result = result.decode("utf-8")
+ if not result or result[0:1] in _invalid_prefixes:
diff --git a/dev-python/passlib/files/passlib-1.7.2-pypy3.patch b/dev-python/passlib/files/passlib-1.7.2-pypy3.patch
new file mode 100644
index 000000000000..304388196b23
--- /dev/null
+++ b/dev-python/passlib/files/passlib-1.7.2-pypy3.patch
@@ -0,0 +1,65 @@
+diff -ur a/passlib/utils/__init__.py b/passlib/utils/__init__.py
+--- a/passlib/utils/__init__.py 2019-11-19 11:41:26.000000000 -0800
++++ b/passlib/utils/__init__.py 2019-12-03 14:16:15.153791186 -0800
+@@ -57,7 +57,7 @@
+ )
+ from passlib.exc import ExpectedStringError
+ from passlib.utils.compat import (add_doc, join_bytes, join_byte_values,
+- join_byte_elems, irange, imap, PY3, u,
++ join_byte_elems, irange, imap, PY3, PYPY, u,
+ join_unicode, unicode, byte_elem_value, nextgetter,
+ unicode_or_bytes_types,
+ get_method_function, suppress_cause)
+@@ -776,23 +776,41 @@
+
+ if PY3:
+ def safe_crypt(secret, hash):
+- if isinstance(secret, bytes):
+- # Python 3's crypt() only accepts unicode, which is then
+- # encoding using utf-8 before passing to the C-level crypt().
+- # so we have to decode the secret.
+- orig = secret
++ if not PYPY:
++ if isinstance(secret, bytes):
++ # Python 3's crypt() only accepts unicode, which is then
++ # encoding using utf-8 before passing to the C-level crypt().
++ # so we have to decode the secret.
++ orig = secret
++ try:
++ secret = secret.decode("utf-8")
++ except UnicodeDecodeError:
++ return None
++ assert secret.encode("utf-8") == orig, \
++ "utf-8 spec says this can't happen!"
++ if _NULL in secret:
++ raise ValueError("null character in secret")
++ else:
++ if isinstance(secret, str):
++ orig = secret
++ try:
++ secret = secret.encode("utf-8")
++ except UnicodeEncodeError:
++ return None
++ assert secret.decode("utf-8") == orig, \
++ "utf-8 spec says this can't happen!"
+ try:
+- secret = secret.decode("utf-8")
++ if _NULL in secret.decode("utf-8"):
++ raise ValueError("null character in secret")
+ except UnicodeDecodeError:
+ return None
+- assert secret.encode("utf-8") == orig, \
+- "utf-8 spec says this can't happen!"
+- if _NULL in secret:
+- raise ValueError("null character in secret")
++
+ if isinstance(hash, bytes):
+ hash = hash.decode("ascii")
+ result = _crypt(secret, hash)
+- if not result or result[0] in _invalid_prefixes:
++ if PYPY and isinstance(result, bytes):
++ result = result.decode("utf-8")
++ if not result or result[0:1] in _invalid_prefixes:
+ return None
+ return result
+ else: