[glib-networking/mcatanzaro/accepted-cas] gnutls: tighten up accepted-cas notify



commit cb4b6963da77f6a76acfee3ae905b019a8b6e65d
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Dec 22 10:32:43 2019 -0600

    gnutls: tighten up accepted-cas notify
    
    The intent was to skip notify if the accepted-cas list is empty both
    before and after the handshake, but this failed because we're only
    checking whether the list exists, not whether it's empty, and it always
    exists.

 tls/gnutls/gtlsclientconnection-gnutls.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/tls/gnutls/gtlsclientconnection-gnutls.c b/tls/gnutls/gtlsclientconnection-gnutls.c
index 734ad75..b493b16 100644
--- a/tls/gnutls/gtlsclientconnection-gnutls.c
+++ b/tls/gnutls/gtlsclientconnection-gnutls.c
@@ -397,7 +397,7 @@ g_tls_client_connection_gnutls_handshake_thread_retrieve_function (gnutls_sessio
    * the algorithms given in pk_algos.
    */
 
-  had_accepted_cas = gnutls->accepted_cas != NULL;
+  had_accepted_cas = gnutls->accepted_cas != NULL && gnutls->accepted_cas->len > 0;
 
   accepted_cas = g_ptr_array_new_with_free_func ((GDestroyNotify)g_byte_array_unref);
   for (i = 0; i < nreqs; i++)
@@ -411,7 +411,7 @@ g_tls_client_connection_gnutls_handshake_thread_retrieve_function (gnutls_sessio
     g_ptr_array_unref (gnutls->accepted_cas);
   gnutls->accepted_cas = accepted_cas;
 
-  gnutls->accepted_cas_changed = gnutls->accepted_cas || had_accepted_cas;
+  gnutls->accepted_cas_changed = (gnutls->accepted_cas && gnutls->accepted_cas->len > 0) || had_accepted_cas;
 
   clear_gnutls_certificate_copy (gnutls);
   g_tls_connection_gnutls_handshake_thread_get_certificate (conn, pcert, pcert_length, pkey);


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