[gnome-online-accounts/wip/kerberos] service fixes



commit 7f31996858a28bd7f58d57b397d45e69ec423529
Author: Ray Strode <rstrode redhat com>
Date:   Mon Aug 20 12:52:24 2012 -0400

    service fixes

 src/goaidentity/goaidentityservice.c |   70 ++++++++++++++++++++++++++++++---
 1 files changed, 63 insertions(+), 7 deletions(-)
---
diff --git a/src/goaidentity/goaidentityservice.c b/src/goaidentity/goaidentityservice.c
index 03f0473..397bfc0 100644
--- a/src/goaidentity/goaidentityservice.c
+++ b/src/goaidentity/goaidentityservice.c
@@ -1227,7 +1227,11 @@ on_identity_signed_out (GoaIdentityManager *manager,
                         GAsyncResult       *result,
                         GSimpleAsyncResult *operation_result)
 {
-  GError *error;
+  GoaIdentityService *self;
+  GError             *error;
+  GoaIdentity        *identity;
+  const char         *identifier;
+  GoaObject          *object;
 
   error = NULL;
   goa_identity_manager_sign_identity_out_finish (manager, result, &error);
@@ -1239,6 +1243,15 @@ on_identity_signed_out (GoaIdentityManager *manager,
       g_simple_async_result_take_error (operation_result, error);
     }
 
+  self = GOA_IDENTITY_SERVICE (g_async_result_get_source_object (G_ASYNC_RESULT (operation_result)));
+  identity = g_object_get_data (G_OBJECT (operation_result), "identity");
+
+  identifier = goa_identity_get_identifier (identity);
+  object = find_object_with_principal (self, identifier, FALSE);
+
+  if (object != NULL)
+    ensure_account_credentials (self, object);
+
   g_simple_async_result_complete_in_idle (operation_result);
   g_object_unref (operation_result);
 }
@@ -1261,6 +1274,12 @@ on_got_identity_for_sign_out (GoaIdentityManager *manager,
       return;
     }
 
+  g_object_set_data_full (G_OBJECT (operation_result),
+                          "identity",
+                          g_object_ref (identity),
+                          (GDestroyNotify)
+                          g_object_unref);
+
   goa_identity_manager_sign_identity_out (manager,
                                           identity,
                                           NULL,
@@ -1705,6 +1724,15 @@ on_identity_removed (GoaIdentityManager *identity_manager,
                      GoaIdentity        *identity,
                      GoaIdentityService *self)
 {
+  GoaObject *object;
+  const char *identifier;
+
+  identifier = goa_identity_get_identifier (identity);
+  object = find_object_with_principal (self, identifier, FALSE);
+
+  if (object != NULL)
+    ensure_account_credentials (self, object);
+
   unexport_identity (self, identity);
 }
 
@@ -2102,13 +2130,28 @@ on_sign_out_for_account_change_done (GoaIdentityService *self,
 }
 
 static void
-on_get_ticket (GoaTicketing       *ticketing,
+on_ticketing_done (GoaIdentityService *self,
+                   GAsyncResult       *result)
+{
+  GoaObject *object;
+
+  object = g_simple_async_result_get_source_tag (G_SIMPLE_ASYNC_RESULT (result));
+
+  ensure_account_credentials (self, object);
+}
+
+static void
+on_got_ticket (GoaTicketing       *ticketing,
                GAsyncResult       *result,
-               GoaAccount         *account)
+               GSimpleAsyncResult *operation_result)
 {
-  GError     *error;
-  const char *account_identity;
+  GoaObject          *object;
+  GoaAccount         *account;
+  GError             *error;
+  const char         *account_identity;
 
+  object = g_simple_async_result_get_source_tag (operation_result);
+  account = goa_object_peek_account (object);
   account_identity = goa_account_get_identity (account);
 
   error = NULL;
@@ -2120,11 +2163,16 @@ on_get_ticket (GoaTicketing       *ticketing,
                  account_identity,
                  error->message);
       g_error_free (error);
+
+      g_simple_async_result_complete_in_idle (operation_result);
+      g_object_unref (operation_result);
       return;
     }
 
   goa_debug ("GoaIdentityService: got ticket for account %s",
              account_identity);
+  g_simple_async_result_complete_in_idle (operation_result);
+  g_object_unref (operation_result);
 }
 
 static void
@@ -2157,14 +2205,22 @@ on_account_interface_added (GDBusObjectManager *manager,
 
   if (ticketing != NULL)
     {
+
+      GSimpleAsyncResult *operation_result;
+
+      operation_result = g_simple_async_result_new (G_OBJECT (self),
+                                                    (GAsyncReadyCallback)
+                                                    on_ticketing_done,
+                                                    NULL,
+                                                    object);
       /* Ticketing interface is present, sign in if not already
        * signed in.
        */
       goa_ticketing_call_get_ticket (ticketing,
                                      NULL,
                                      (GAsyncReadyCallback)
-                                     on_get_ticket,
-                                     account);
+                                     on_got_ticket,
+                                     operation_result);
       return;
     }
 }



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