[gnome-online-accounts] daemon: Don't store empty entries in the keyring



commit 3dfcd3c4df589db25bffe38c7def05295ee0a663
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu May 5 17:43:35 2016 +0200

    daemon: Don't store empty entries in the keyring
    
    If the account is being created without any credentials, then we assume
    that the backend either (a) doesn't need any credentials (eg., media
    servers), or (b) has other means of differentiating between accounts
    that need credentials and those that do not (eg., Kerberos).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688041

 src/daemon/goadaemon.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
index 3ac05d4..82b91b4 100644
--- a/src/daemon/goadaemon.c
+++ b/src/daemon/goadaemon.c
@@ -862,6 +862,7 @@ get_all_providers_cb (GObject      *source,
   gchar *group;
   gchar *key_file_data;
   gsize length;
+  gsize n_credentials;
   gchar *object_path;
   GVariantIter iter;
   const gchar *key;
@@ -981,14 +982,18 @@ get_all_providers_cb (GObject      *source,
       goto out;
     }
 
-  /* We don't want to fail AddAccount if we could not store the
-   * credentials in the keyring.
-   */
-  goa_utils_store_credentials_for_id_sync (provider,
-                                           id,
-                                           data->credentials,
-                                           NULL, /* GCancellable */
-                                           NULL);
+  n_credentials = g_variant_n_children (data->credentials);
+  if (n_credentials > 0)
+    {
+      /* We don't want to fail AddAccount if we could not store the
+       * credentials in the keyring.
+       */
+      goa_utils_store_credentials_for_id_sync (provider,
+                                               id,
+                                               data->credentials,
+                                               NULL, /* GCancellable */
+                                               NULL);
+    }
 
   goa_daemon_reload_configuration (data->daemon);
 


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