[telepathy-mission-control-5.12] telepathy-mission-control: Default accounts backend: finish password migrations that Empathy 3. 0 started
Simon McVittie
smcv at kemper.freedesktop.org
Thu Sep 20 06:58:44 PDT 2012
Module: telepathy-mission-control
Branch: telepathy-mission-control-5.12
Commit: eaefb264316f206186b2ac7f1f36e6a4692deb3d
URL: http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=eaefb264316f206186b2ac7f1f36e6a4692deb3d
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Thu Sep 20 12:28:59 2012 +0100
Default accounts backend: finish password migrations that Empathy 3.0 started
Signed-off-by: Simon McVittie <simon.mcvittie at 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 at collabora.co.uk>
---
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 cd6d019..2fb0300 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);
More information about the telepathy-commits
mailing list