[glib-networking] gnutls: handshake context should not be exposed to API users



commit 3e26ae1271eb33e0a35387e50a6cc7e9876a6b8d
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Fri Mar 29 16:22:13 2019 -0500

    gnutls: handshake context should not be exposed to API users
    
    The handshake context is supposed to be private to glib-networking, but
    here it's accidentally exposed as the thread-default main context at the
    time the accept-certificate signal is emitted. So that's no good. Let's
    temporarily restore the previous thread-default main context for the
    signal emission.

 tls/gnutls/gtlsconnection-gnutls.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index e90507a..b4444dd 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -1889,9 +1889,11 @@ accept_peer_certificate (GTlsConnectionGnutls *gnutls,
 
   if (!accepted)
     {
+      g_main_context_pop_thread_default (priv->handshake_context);
       accepted = g_tls_connection_emit_accept_certificate (G_TLS_CONNECTION (gnutls),
                                                            peer_certificate,
                                                            peer_certificate_errors);
+      g_main_context_push_thread_default (priv->handshake_context);
     }
 
   return accepted;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]