summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-08-30 18:09:21 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2012-09-06 10:49:36 +0100
commitdbba880903def15bc7bb5fdb9d05ee310f1a5bfe (patch)
tree707a71156d7c13c6f348e6feb0f9fdd8f5c1714e
parenta5fb89bad8b6fc7498cb7056faea1fdaa44de986 (diff)
downloadtelepathy-mission-control-dbba880903def15bc7bb5fdb9d05ee310f1a5bfe.tar.gz
Default account backend: when deleting, always delete from both places
Our tracking of whether something is "secret" (in the gnome-keyring) is pretty shaky, and in particular, we can forget that things are meant to be "secret" sometimes (we lose that information when deleting parameters). Happily, when we're deleting things, it doesn't actually matter: the right thing to do is clearly to delete from both locations, regardless of where we think it ought to be. Similarly, when we're setting a property to a new value, it's appropriate to delete it from both locations, then put it in the right location (only). Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=42088 Cherry-picked-from: 5b4954d2c959c4ba7f6c67b7d8e16eaa5ab272dd
-rw-r--r--src/mcd-account-manager-default.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/mcd-account-manager-default.c b/src/mcd-account-manager-default.c
index e156de1b..221c5d07 100644
--- a/src/mcd-account-manager-default.c
+++ b/src/mcd-account-manager-default.c
@@ -411,6 +411,10 @@ _set (const McpAccountStorage *self,
/* if we have a keyring, secrets are segregated */
secret = mcp_account_manager_parameter_is_secret (am, account, key);
+ /* remove it from both sets, then re-add it to the right one if non-null */
+ g_key_file_remove_key (amd->secrets, account, key, NULL);
+ g_key_file_remove_key (amd->keyfile, account, key, NULL);
+
if (val != NULL)
{
if (secret)
@@ -418,13 +422,6 @@ _set (const McpAccountStorage *self,
else
g_key_file_set_value (amd->keyfile, account, key, val);
}
- else
- {
- if (secret)
- g_key_file_remove_key (amd->secrets, account, key, NULL);
- else
- g_key_file_remove_key (amd->keyfile, account, key, NULL);
- }
/* if we removed the account before, it now exists again, so... */
g_hash_table_remove (amd->removed_accounts, account);
@@ -561,8 +558,10 @@ _delete (const McpAccountStorage *self,
g_key_file_remove_group (amd->keyfile, account, NULL);
_delete_from_keyring (self, am, account, NULL);
}
- else if (mcp_account_manager_parameter_is_secret (am, account, key))
+ else
{
+ /* always delete from keyring, even if we didn't previously
+ * think it was secret - we might have been wrong */
_delete_from_keyring (self, am, account, key);
}