[glib-networking] gnutls: ensure connection never fails without an error



commit 629bbca0bf6f9ffe8ae5c7f3ec8255224c7f2d18
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sat Dec 28 14:47:19 2019 -0600

    gnutls: ensure connection never fails without an error
    
    This regressed in 18360afb03b5b23887f6f027bddb4f19c9fc4be8, when I
    carelessly added a codepath that allows initialization to fail without
    an error.

 tls/gnutls/gtlsconnection-gnutls.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index 8dd73d0..94c5620 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -137,7 +137,12 @@ g_tls_connection_gnutls_initable_init (GInitable     *initable,
 
   ret = gnutls_certificate_allocate_credentials (&priv->creds);
   if (ret != GNUTLS_E_SUCCESS)
-    return FALSE;
+    {
+      g_set_error (error, G_TLS_ERROR, G_TLS_ERROR_MISC,
+                   _("Could not create TLS connection: %s"),
+                   gnutls_strerror (ret));
+      return FALSE;
+    }
 
   gnutls_init (&priv->session, flags);
 


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