[gnome-online-accounts] kerberos: Assert against impossible SignIn failures



commit bbea164b6a685f553a2e111c44d8cacfa4ddb1f6
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue May 30 20:29:58 2017 +0200

    kerberos: Assert against impossible SignIn failures
    
    SignIn fails with ERROR_ACCESSING_CREDENTIALS when
    goa-identity-service is unable to locate a GcrSecretExchange for a
    given secret key. This can never happen unless the Kerberos provider
    misused the org.gnome.Identity.Manager API.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686131

 src/goabackend/goakerberosprovider.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/src/goabackend/goakerberosprovider.c b/src/goabackend/goakerberosprovider.c
index d26b15b..2d9db95 100644
--- a/src/goabackend/goakerberosprovider.c
+++ b/src/goabackend/goakerberosprovider.c
@@ -1583,6 +1583,7 @@ sign_in_identity_sync (GoaKerberosProvider  *self,
   char               *concealed_secret;
   char               *identity_object_path = NULL;
   gboolean            keys_exchanged;
+  GError             *local_error;
   GVariantBuilder     details;
 
   secret_exchange = gcr_secret_exchange_new (NULL);
@@ -1624,12 +1625,27 @@ sign_in_identity_sync (GoaKerberosProvider  *self,
     }
 
   g_mutex_lock (&identity_manager_mutex);
+
+  local_error = NULL;
   goa_identity_service_manager_call_sign_in_sync (identity_manager,
                                                   identifier,
                                                   g_variant_builder_end (&details),
                                                   &identity_object_path,
                                                   cancellable,
-                                                  error);
+                                                  &local_error);
+
+  if (local_error != NULL)
+    {
+      if (g_error_matches (local_error,
+                           GOA_IDENTITY_MANAGER_ERROR,
+                           GOA_IDENTITY_MANAGER_ERROR_ACCESSING_CREDENTIALS))
+        {
+          g_assert_not_reached ();
+        }
+
+      g_propagate_error (error, local_error);
+    }
+
   g_mutex_unlock (&identity_manager_mutex);
 
  out:


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