summaryrefslogtreecommitdiffstats
path: root/Modules/_ssl
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-03-21 15:32:19 (GMT)
committerGitHub <noreply@github.com>2021-03-21 15:32:19 (GMT)
commit93b0da7527ae1b7d705052cf352ef9da81e608ec (patch)
tree416e8eb788a416cdcbbfde4580cff75bca40423d /Modules/_ssl
parent50511677f59464e612cfef0cd0e139fe07e87737 (diff)
downloadcpython-93b0da7527ae1b7d705052cf352ef9da81e608ec.zip
cpython-93b0da7527ae1b7d705052cf352ef9da81e608ec.tar.gz
cpython-93b0da7527ae1b7d705052cf352ef9da81e608ec.tar.bz2
bpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback (GH-24957)
OpenSSL copies the internal message callback from SSL_CTX->msg_callback to SSL->msg_callback. SSL_set_SSL_CTX() does not update SSL->msg_callback to use the callback value of the new context. PySSL_set_context() now resets the callback and _PySSL_msg_callback() resets thread state in error path. Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit 77cde5042a2f1eae489c11a67540afaf43cd5cdf) Co-authored-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Modules/_ssl')
-rw-r--r--Modules/_ssl/debughelpers.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/_ssl/debughelpers.c b/Modules/_ssl/debughelpers.c
index b840da2..af56f9d 100644
--- a/Modules/_ssl/debughelpers.c
+++ b/Modules/_ssl/debughelpers.c
@@ -23,6 +23,7 @@ _PySSL_msg_callback(int write_p, int version, int content_type,
ssl_obj = (PySSLSocket *)SSL_get_app_data(ssl);
assert(PySSLSocket_Check(ssl_obj));
if (ssl_obj->ctx->msg_cb == NULL) {
+ PyGILState_Release(threadstate);
return;
}