diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-04-09 13:46:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-09 13:46:11 (GMT) |
commit | a188bd44ac3c54dc3bf927f1b10464ab80f37549 (patch) | |
tree | 20382fe9d8d4b3a93c1d663a03ddf27fe51973c0 /Modules/_ssl.c | |
parent | 4d9336d1147a7855a03e441120bf720a73cb742f (diff) | |
download | cpython-a188bd44ac3c54dc3bf927f1b10464ab80f37549.zip cpython-a188bd44ac3c54dc3bf927f1b10464ab80f37549.tar.gz cpython-a188bd44ac3c54dc3bf927f1b10464ab80f37549.tar.bz2 |
bpo-43789: OpenSSL 3.0.0 Don't call passwd callback again in error case (GH-25303)
(cherry picked from commit d3b73f32ef7c693a6ae8c54eb0e62df3b5315caf)
Co-authored-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r-- | Modules/_ssl.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index aab5713..3fbb363 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -3931,6 +3931,13 @@ _password_callback(char *buf, int size, int rwflag, void *userdata) PySSL_END_ALLOW_THREADS_S(pw_info->thread_state); + if (pw_info->error) { + /* already failed previously. OpenSSL 3.0.0-alpha14 invokes the + * callback multiple times which can lead to fatal Python error in + * exception check. */ + goto error; + } + if (pw_info->callable) { fn_ret = _PyObject_CallNoArg(pw_info->callable); if (!fn_ret) { |