]>
Commit | Line | Data |
---|---|---|
fb6274f5 | 1 | From 3edeed879871a10acbe802f4a68cff3d4869dbde Mon Sep 17 00:00:00 2001 |
5333ada9 RN |
2 | From: Romain Naour <[email protected]> |
3 | Date: Thu, 12 Nov 2020 00:16:18 +0100 | |
4 | Subject: [PATCH] lib/crypt: uClibc-ng doesn't set errno when encryption method | |
5 | is not available | |
6 | ||
7 | Since commit [1] in cpython, an exception is raised when an encryption method | |
8 | is not available. This eception is handled only if errno is set to EINVAL by | |
9 | crypt() but uClibc-ng doesn't set errno in crypt() [2]. | |
10 | ||
11 | Fixes: | |
12 | https://gitlab.com/buildroot.org/buildroot/-/jobs/830981961 | |
13 | https://gitlab.com/buildroot.org/buildroot/-/jobs/830981979 | |
14 | ||
15 | [1] https://github.com/python/cpython/commit/0d3fe8ae4961bf551e7d5e42559e2ede1a08fd7c | |
16 | [2] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libcrypt/crypt.c?h=v1.0.36#n29 | |
17 | ||
18 | Signed-off-by: Romain Naour <[email protected]> | |
c0ee83d1 LD |
19 | [Daniel: updated for 3.10.7] |
20 | Signed-off-by: Daniel Lang <[email protected]> | |
5333ada9 RN |
21 | --- |
22 | Lib/crypt.py | 4 +++- | |
23 | 1 file changed, 3 insertions(+), 1 deletion(-) | |
24 | ||
25 | diff --git a/Lib/crypt.py b/Lib/crypt.py | |
fb6274f5 | 26 | index de4a14a388..ba482487a7 100644 |
5333ada9 RN |
27 | --- a/Lib/crypt.py |
28 | +++ b/Lib/crypt.py | |
738500c2 | 29 | @@ -98,7 +98,9 @@ def _add_method(name, *args, rounds=None): |
5333ada9 RN |
30 | result = crypt('', salt) |
31 | except OSError as e: | |
32 | # Not all libc libraries support all encryption methods. | |
c0ee83d1 | 33 | - if e.errno in {errno.EINVAL, errno.EPERM, errno.ENOSYS}: |
5333ada9 RN |
34 | + # Not all libc libraries set errno when encryption method is not |
35 | + # available. | |
c0ee83d1 | 36 | + if e.errno in {errno.EINVAL, errno.EPERM, errno.ENOSYS} or e.errno == 0: |
5333ada9 RN |
37 | return False |
38 | raise | |
39 | if result and len(result) == method.total_size: | |
40 | -- | |
fb6274f5 | 41 | 2.34.1 |
5333ada9 | 42 |