From 96eaa31f816f6e8abb6a4ed94fc271ace14a4644 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 30 Aug 2012 18:51:19 +0100 Subject: [PATCH 6/8] account-store-default: load the same names that MC would This tool was previously not deleting "param-". --- tests/account-store-default.c | 13 ++++++++++--- 1 file 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); -- 1.7.10.4