summaryrefslogtreecommitdiffstats
path: root/Modules/_ssl.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2021-04-09 13:23:38 (GMT)
committerGitHub <noreply@github.com>2021-04-09 13:23:38 (GMT)
commitd3b73f32ef7c693a6ae8c54eb0e62df3b5315caf (patch)
treec2894776911d3bc7feec987f7d5167174c649e54 /Modules/_ssl.c
parentbd88ccb943c0ea672c14a87e76157fade4feae11 (diff)
downloadcpython-d3b73f32ef7c693a6ae8c54eb0e62df3b5315caf.zip
cpython-d3b73f32ef7c693a6ae8c54eb0e62df3b5315caf.tar.gz
cpython-d3b73f32ef7c693a6ae8c54eb0e62df3b5315caf.tar.bz2
bpo-43789: OpenSSL 3.0.0 Don't call passwd callback again in error case (GH-25303)
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r--Modules/_ssl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index f3c3b20..94b06dd 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -3926,6 +3926,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) {