[glib-networking] gnutls: Fix check for certain handshake failure conditions



commit 331767109c598481ddd258d58b9b8c1fbf7aff3c
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Tue Mar 2 10:13:18 2021 -0600

    gnutls: Fix check for certain handshake failure conditions
    
    It seems we have no tests to see if these errors work or not, because
    the code is comparing a GTlsConnectionBaseStatus code to a GnuTLS error
    code. It has been broken since 0e94c20acdc524e82c19eb95884887b74852326d.
    The code previously used "status" as the name for a GnuTLS error code,
    then changed it to be a GTlsConnectionBaseStatus in that commit. Alas, I
    should have used a different intermediary name instead, which would have
    caught this as a compiler error.
    
    Getting the tests to return particular errors is likely impractical.
    Let's just fix this and move on.

 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 0a90396..bc3f9c8 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -374,9 +374,9 @@ end_gnutls_io (GTlsConnectionGnutls  *gnutls,
           return G_TLS_CONNECTION_BASE_ERROR;
         }
 
-      if (status == GNUTLS_E_UNEXPECTED_PACKET_LENGTH ||
-          status == GNUTLS_E_DECRYPTION_FAILED ||
-          status == GNUTLS_E_UNSUPPORTED_VERSION_PACKET)
+      if (ret == GNUTLS_E_UNEXPECTED_PACKET_LENGTH ||
+          ret == GNUTLS_E_DECRYPTION_FAILED ||
+          ret == GNUTLS_E_UNSUPPORTED_VERSION_PACKET)
         {
           g_clear_error (&my_error);
           g_set_error (error, G_TLS_ERROR, G_TLS_ERROR_NOT_TLS,


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