[glib-networking] Don't clear peer certificate when rehandshaking



commit b63615c6a6417c78aa633565736d9f8a7fbafc28
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sat Nov 10 19:41:44 2018 -0600

    Don't clear peer certificate when rehandshaking
    
    The client auth tests check that the client connection's peer
    certificate is nonnull, but it will in fact be null if the server has
    initiated a rehandshake and the rehandshake has not yet finished. It
    should be possible to avoid this by stalling the tests until the
    rehandshake has completed, but there's really no need to clear it here
    in the first place.
    
    Of course, we still need to clear it when performing certificate
    verification.

 tls/gnutls/gtlsconnection-gnutls.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index a2fd4f1..d9c372a 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -1848,6 +1848,9 @@ accept_certificate_cb (gpointer user_data)
 
   g_mutex_lock (&priv->verify_certificate_mutex);
 
+  g_clear_object (&priv->peer_certificate);
+  priv->peer_certificate_errors = 0;
+
   if (gnutls_certificate_type_get (priv->session) == GNUTLS_CRT_X509)
     {
       priv->peer_certificate = get_peer_certificate_from_session (gnutls);
@@ -1976,9 +1979,6 @@ handshake_thread (GTask        *task,
 
   priv->started_handshake = TRUE;
 
-  g_clear_object (&priv->peer_certificate);
-  priv->peer_certificate_errors = 0;
-
   if (!priv->ever_handshaked)
     g_tls_connection_gnutls_set_handshake_priority (gnutls);
 


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