telepathy-mission-control: account-store-default: load the same names that MC would

Simon McVittie smcv at kemper.freedesktop.org
Fri Aug 31 07:27:01 PDT 2012


Module: telepathy-mission-control
Branch: master
Commit: 455d7be6901945117761e697c9e561b4c0165ee7
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=455d7be6901945117761e697c9e561b4c0165ee7

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Thu Aug 30 18:51:19 2012 +0100

account-store-default: load the same names that MC would

This tool was previously not deleting "param-".

Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
Reviewed-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=42088

---

 tests/account-store-default.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/tests/account-store-default.c b/tests/account-store-default.c
index bd33ff3..a569778 100644
--- a/tests/account-store-default.c
+++ b/tests/account-store-default.c
@@ -73,6 +73,11 @@ _get_secret_from_keyring (const gchar *account, const gchar *key)
   GList *i;
   gchar *secret = NULL;
 
+  /* for compatibility with old gnome keyring code we must strip  *
+   * the param- prefix from the name before loading from the keyring */
+  if (g_str_has_prefix (key, "param-"))
+    key += strlen ("param-");
+
   gnome_keyring_attribute_list_append_string (match, "account", account);
 
   ok = gnome_keyring_find_items_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
@@ -233,16 +238,18 @@ default_set (const gchar *account,
   GKeyFile *keyfile = NULL;
 
 #if ENABLE_GNOME_KEYRING
-  if (g_str_equal (key, "param-password"))
+  /* we want to catch, for instance, param-password or param-proxy-password */
+  if (g_str_has_prefix (key, "param-") && g_str_has_suffix (key, "-password"))
     {
       GnomeKeyringResult result = GNOME_KEYRING_RESULT_CANCELLED;
       gchar *name =
-        g_strdup_printf ("account: %s; param: %s", account, "password");
+        g_strdup_printf ("account: %s; param: %s", account,
+            key + strlen ("param-"));
 
       result = gnome_keyring_store_password_sync (&keyring_schema, NULL,
           name, value,
           "account", account,
-          "param", "password",
+          "param", key + strlen ("param-"),
           NULL);
 
       g_free (name);



More information about the telepathy-commits mailing list