[glib-networking/pgriffis/pkcs11-pin-handling] gnutls-pkcs11: Use info messages rather than warnings for internal errors




commit af3ceccf864fc46f6bedcab23bc1728a6780e18a
Author: Patrick Griffis <pgriffis igalia com>
Date:   Wed May 26 14:22:13 2021 -0500

    gnutls-pkcs11: Use info messages rather than warnings for internal errors
    
    These aren't really actionable or caused by programmer errors and
    make tests harder to write for properly handling these cases.

 tls/gnutls/gtlscertificate-gnutls.c | 2 +-
 tls/gnutls/gtlsconnection-gnutls.c  | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/tls/gnutls/gtlscertificate-gnutls.c b/tls/gnutls/gtlscertificate-gnutls.c
index 9d81cce..d342e1a 100644
--- a/tls/gnutls/gtlscertificate-gnutls.c
+++ b/tls/gnutls/gtlscertificate-gnutls.c
@@ -528,7 +528,7 @@ g_tls_certificate_gnutls_copy  (GTlsCertificateGnutls  *gnutls,
       status = gnutls_privkey_import_pkcs11_url (*pkey,
                                                  gnutls->private_key_pkcs11_uri ? 
gnutls->private_key_pkcs11_uri : gnutls->pkcs11_uri);
       if (status != GNUTLS_E_SUCCESS)
-        g_warning ("Failed to copy PKCS #11 private key: %s", gnutls_strerror (status));
+        g_info ("Failed to copy PKCS #11 private key: %s", gnutls_strerror (status));
     }
   else
     {
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index bc3f9c8..337ce9e 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -267,9 +267,9 @@ on_pin_request (void         *userdata,
   switch (result)
     {
     case G_TLS_INTERACTION_FAILED:
-      if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-        g_warning ("Error getting PIN: %s", error->message);
-      g_error_free (error);
+      if (error)
+        g_info ("Error getting PIN: %s", error->message);
+      g_clear_error (&error);
       break;
     case G_TLS_INTERACTION_UNHANDLED:
       break;
@@ -278,7 +278,7 @@ on_pin_request (void         *userdata,
         gsize password_size;
         const guchar *password_data = g_tls_password_get_value (password, &password_size);
         if (password_size > pin_max)
-          g_warning ("PIN is larger than max PIN size");
+          g_info ("PIN is larger than max PIN size");
 
         memcpy (pin, password_data, MIN (password_size, pin_max));
         ret = GNUTLS_E_SUCCESS;


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