diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-09-20 12:28:59 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-09-20 12:28:59 +0100 |
commit | eaefb264316f206186b2ac7f1f36e6a4692deb3d (patch) | |
tree | fdbd2fcda1c5aa7c5d4dc62723ff72daa1e44973 | |
parent | 5c89fe0b540eaeecd72379f1f2b9da07883425e9 (diff) |
Default accounts backend: finish password migrations that Empathy 3.0 started
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=42088
Bug-Debian: http://bugs.debian.org/687933
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
-rw-r--r-- | src/mcd-account-manager-default.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/mcd-account-manager-default.c b/src/mcd-account-manager-default.c index cd6d0191..2fb03000 100644 --- a/src/mcd-account-manager-default.c +++ b/src/mcd-account-manager-default.c @@ -20,7 +20,11 @@ */ #include "config.h" + #include <string.h> + +#include <telepathy-glib/telepathy-glib.h> + #include "mcd-account-manager-default.h" #include "mcd-debug.h" @@ -286,6 +290,57 @@ _get_secrets_from_keyring (const McpAccountStorage *self, g_warning ("Unsupported value type for %s.%s", account, name); } + if (!tp_strdiff (param, "password")) + { + /* Empathy 3.0 was meant to migrate passwords from MC to + * itself, but it couldn't complete the migration by + * deleting the password from MC, because MC had several + * bugs that meant deleting passwords didn't work. To atone + * for our past sins, detect an incomplete migration and + * complete it. */ + GnomeKeyringResult empathy_ok = + GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON; + GnomeKeyringAttributeList *empathy_match = + gnome_keyring_attribute_list_new (); + GList *empathy_items = NULL; + + gnome_keyring_attribute_list_append_string (empathy_match, + "account-id", account); + gnome_keyring_attribute_list_append_string (empathy_match, + "param-name", "password"); + + empathy_ok = gnome_keyring_find_items_sync ( + GNOME_KEYRING_ITEM_GENERIC_SECRET, empathy_match, + &empathy_items); + + if (empathy_ok == GNOME_KEYRING_RESULT_OK && + empathy_items != NULL) + { + KeyringSetData *ksd = g_slice_new0 (KeyringSetData); + + DEBUG ("An Empathy 3.0 password migration wasn't finished " + "due to fd.o #42088. Finishing it now by deleting the " + "password for %s", account); + + ksd->account = g_strdup (account); + ksd->name = g_strdup ("password"); + ksd->set = FALSE; + + gnome_keyring_delete_password (&keyring_schema, + _keyring_set_cb, ksd, NULL, + "account", account, + "param", "password", + NULL); + } + + gnome_keyring_found_list_free (empathy_items); + + /* behave as if it had already been deleted, i.e. we never + * actually found it... */ + param = NULL; + value = NULL; + } + if (param != NULL && value != NULL) { gchar *key = g_strdup_printf ("param-%s", param); |