[gnome-online-accounts/gnome-3-18] identity: Allow multiple simultaneous sign-in requests from one sender



commit 33d5a935148e7b08cffe4ce1fda8bdad247d8026
Author: Ray Strode <rstrode redhat com>
Date:   Sun Oct 11 11:35:04 2015 -0400

    identity: Allow multiple simultaneous sign-in requests from one sender
    
    If we have more than one kerberos account associated, then we may do
    more than one sign in request in quick succession.
    
    The identity service doesn't handle this very well, since it tracks
    secret exchange requests per sender. Let's addresses the problem by
    keying secret exchange requests, based on identifier + sender.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756394

 src/goabackend/goakerberosprovider.c   |    1 +
 src/goaidentity/goaidentityservice.c   |   19 ++++++++++++++++---
 src/goaidentity/org.gnome.Identity.xml |    1 +
 3 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/src/goabackend/goakerberosprovider.c b/src/goabackend/goakerberosprovider.c
index 2a13158..26b105f 100644
--- a/src/goabackend/goakerberosprovider.c
+++ b/src/goabackend/goakerberosprovider.c
@@ -1494,6 +1494,7 @@ sign_in_identity_sync (GoaKerberosProvider  *self,
 
   g_mutex_lock (&identity_manager_mutex);
   keys_exchanged = goa_identity_service_manager_call_exchange_secret_keys_sync (identity_manager,
+                                                                                identifier,
                                                                                 secret_key,
                                                                                 &return_key,
                                                                                 cancellable,
diff --git a/src/goaidentity/goaidentityservice.c b/src/goaidentity/goaidentityservice.c
index 6b6225a..19b382f 100644
--- a/src/goaidentity/goaidentityservice.c
+++ b/src/goaidentity/goaidentityservice.c
@@ -363,9 +363,14 @@ goa_identity_service_handle_sign_in (GoaIdentityServiceManager *manager,
   if (secret_key != NULL)
     {
       GcrSecretExchange *secret_exchange;
+      gchar *key;
 
-      secret_exchange = g_hash_table_lookup (self->priv->key_holders,
-                                             g_dbus_method_invocation_get_sender (invocation));
+      key = g_strdup_printf ("%s %s",
+                             g_dbus_method_invocation_get_sender (invocation),
+                             identifier);
+
+      secret_exchange = g_hash_table_lookup (self->priv->key_holders, key);
+      g_free (key);
 
       if (secret_exchange == NULL)
         {
@@ -553,10 +558,12 @@ on_caller_watched (GDBusConnection    *connection,
 {
   GoaIdentityService    *self;
   GcrSecretExchange     *secret_exchange;
+  const char            *identifier;
   const char            *input_key;
   char                  *output_key;
 
   self = GOA_IDENTITY_SERVICE (g_async_result_get_source_object (G_ASYNC_RESULT (operation_result)));
+  identifier = g_object_get_data (G_OBJECT (operation_result), "identifier");
   input_key = g_object_get_data (G_OBJECT (operation_result), "input-key");
 
   secret_exchange = gcr_secret_exchange_new (NULL);
@@ -574,7 +581,7 @@ on_caller_watched (GDBusConnection    *connection,
     }
 
   g_hash_table_insert (self->priv->key_holders,
-                       g_strdup (name_owner),
+                       g_strdup_printf ("%s %s", name_owner, identifier),
                        secret_exchange);
 
   output_key = gcr_secret_exchange_send (secret_exchange, NULL, 0);
@@ -607,6 +614,7 @@ on_caller_vanished (GDBusConnection    *connection,
 static gboolean
 goa_identity_service_handle_exchange_secret_keys (GoaIdentityServiceManager *manager,
                                                   GDBusMethodInvocation     *invocation,
+                                                  const char                *identifier,
                                                   const char                *input_key)
 {
   GoaIdentityService     *self = GOA_IDENTITY_SERVICE (manager);
@@ -625,6 +633,11 @@ goa_identity_service_handle_exchange_secret_keys (GoaIdentityServiceManager *man
   g_object_set_data (G_OBJECT (operation_result), "cancellable", cancellable);
 
   g_object_set_data_full (G_OBJECT (operation_result),
+                          "identifier",
+                          g_strdup (identifier),
+                          (GDestroyNotify)
+                          g_free);
+  g_object_set_data_full (G_OBJECT (operation_result),
                           "input-key",
                           g_strdup (input_key),
                           (GDestroyNotify)
diff --git a/src/goaidentity/org.gnome.Identity.xml b/src/goaidentity/org.gnome.Identity.xml
index 28d80e8..2f612d1 100644
--- a/src/goaidentity/org.gnome.Identity.xml
+++ b/src/goaidentity/org.gnome.Identity.xml
@@ -28,6 +28,7 @@
   <interface name="org.gnome.Identity.Manager">
 
     <method name="ExchangeSecretKeys">
+      <arg name="identifier" type="s" direction="in"/>
       <arg name="input_key" type="s" direction="in"/>
       <arg name="output_key" type="s" direction="out"/>
     </method>


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