[gnome-online-accounts/wip/rishi/fedora-provider: 11/12] daemon: Wipe the SessionId, if any, for permanent accounts



commit e3875e3defbb2db254f7bd6c102a5df8ddde5274
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Aug 20 22:43:09 2019 +0200

    daemon: Wipe the SessionId, if any, for permanent accounts
    
    This can be useful when upgrading an account from temporary to
    permanent, which can happen when adding any kind of Kerberos account.
    
    The user-specified credentials of a Kerberos account can only be
    verified by attempting to sign in the given principal. If successful
    this will add the principal to the Kerberos credential cache. This will
    create a temporary GOA account if one wasn't preemptively added before
    attempting to sign in, which is what the existing Kerberos provider
    does. However, this is a bit odd because it differs from the sequence
    of steps taken by all the other providers.
    
    This change will enable removing this oddity from the Kerberos provider
    in future. In the more near term, a subsequent commit will add a
    provider for the Fedora Account System which will be a branded
    Kerberos provider, and it will take advantage of this.
    
    https://gitlab.gnome.org/GNOME/gnome-online-accounts/issues/26

 src/daemon/goadaemon.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
index f20831e2..bfbe41c8 100644
--- a/src/daemon/goadaemon.c
+++ b/src/daemon/goadaemon.c
@@ -1196,6 +1196,19 @@ get_all_providers_cb (GObject      *source,
               guid = g_dbus_connection_get_guid (data->daemon->connection);
               g_key_file_set_string (key_file, group, "SessionId", guid);
             }
+          else
+            {
+              error = NULL;
+              if (!g_key_file_remove_key (key_file, group, "SessionId", &error))
+                {
+                  if (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)
+                      && !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND))
+                    {
+                      g_dbus_method_invocation_take_error (data->invocation, error);
+                      goto out;
+                    }
+                }
+            }
         }
 
       /* Skip Id since we already handled it above. */


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