diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2013-11-08 13:17:10 -0500 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-01-29 19:28:29 +0000 |
commit | 4db6783e78972a35a1f66ed0311cf8080a1b63e1 (patch) | |
tree | 4523ab7696f8e1c768e194e203519ee0c48c216f /src | |
parent | 0e2b32c64568c39a9bbcc556f5ee1a3cae811928 (diff) |
Remove all notion of secret parameter
We now depend on SASLAuthentication for handling secret, and MC
does not have gnome-keyring anymore.
[Adjusted to apply before other storage API changes -smcv]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71384
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/mcd-account.c | 16 | ||||
-rw-r--r-- | src/mcd-account.h | 3 | ||||
-rw-r--r-- | src/mcd-storage.c | 73 | ||||
-rw-r--r-- | src/mcd-storage.h | 3 |
4 files changed, 7 insertions, 88 deletions
diff --git a/src/mcd-account.c b/src/mcd-account.c index 7b51afb8..752e9266 100644 --- a/src/mcd-account.c +++ b/src/mcd-account.c @@ -378,9 +378,8 @@ _mcd_account_set_parameter (McdAccount *account, const gchar *name, McdAccountPrivate *priv = account->priv; McdStorage *storage = priv->storage; const gchar *account_name = mcd_account_get_unique_name (account); - gboolean secret = mcd_account_parameter_is_secret (account, name); - mcd_storage_set_parameter (storage, account_name, name, value, secret); + mcd_storage_set_parameter (storage, account_name, name, value); } static GType mc_param_type (const TpConnectionManagerParam *param); @@ -5156,19 +5155,6 @@ _mcd_account_needs_dispatch (McdAccount *self) return self->priv->always_dispatch; } -gboolean -mcd_account_parameter_is_secret (McdAccount *self, const gchar *name) -{ - McdAccountPrivate *priv = self->priv; - const TpConnectionManagerParam *param; - - param = mcd_manager_get_protocol_param (priv->manager, - priv->protocol_name, name); - - return (param != NULL && - tp_connection_manager_param_is_secret (param)); -} - void _mcd_account_set_changing_presence (McdAccount *self, gboolean value) { diff --git a/src/mcd-account.h b/src/mcd-account.h index 59d8d9e3..3aad723f 100644 --- a/src/mcd-account.h +++ b/src/mcd-account.h @@ -129,9 +129,6 @@ McdConnection *mcd_account_get_connection (McdAccount *account); gboolean mcd_account_check_request (McdAccount *account, GHashTable *request, GError **error); -gboolean mcd_account_parameter_is_secret (McdAccount *self, - const gchar *name); - void mcd_account_altered_by_plugin (McdAccount *account, const gchar *name); gchar * mcd_account_dup_display_name (McdAccount *self); diff --git a/src/mcd-storage.c b/src/mcd-storage.c index f82cb797..6cc603b4 100644 --- a/src/mcd-storage.c +++ b/src/mcd-storage.c @@ -72,9 +72,6 @@ typedef struct { * e.g. { 'account': 'fred@example.com', 'password': 'foo' } * keys of @parameters and @escaped_parameters are disjoint */ GHashTable *escaped_parameters; - /* set of owned strings - * e.g. { 'password': 'password' } */ - GHashTable *secrets; } McdStorageAccount; static void @@ -85,7 +82,6 @@ mcd_storage_account_free (gpointer p) g_hash_table_unref (sa->attributes); g_hash_table_unref (sa->parameters); g_hash_table_unref (sa->escaped_parameters); - g_hash_table_unref (sa->secrets); g_slice_free (McdStorageAccount, sa); } @@ -222,8 +218,6 @@ ensure_account (McdStorage *self, g_free, (GDestroyNotify) g_variant_unref); sa->escaped_parameters = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); - sa->secrets = g_hash_table_new_full (g_str_hash, g_str_equal, - g_free, NULL); g_hash_table_insert (self->accounts, g_strdup (account), sa); } @@ -430,12 +424,6 @@ mcpa_set_parameter (const McpAccountManager *ma, if (value != NULL) g_hash_table_insert (sa->parameters, g_strdup (parameter), g_variant_ref_sink (value)); - - if (flags & MCP_PARAMETER_FLAG_SECRET) - { - DEBUG ("flagging %s parameter %s as secret", account, parameter); - g_hash_table_add (sa->secrets, g_strdup (parameter)); - } } static void @@ -519,47 +507,6 @@ list_keys (const McpAccountManager *ma, return (GStrv) g_ptr_array_free (ret, FALSE); } -static gboolean -is_secret (const McpAccountManager *ma, - const gchar *account, - const gchar *key) -{ - McdStorage *self = MCD_STORAGE (ma); - McdStorageAccount *sa = lookup_account (self, account); - - if (sa == NULL || !g_str_has_prefix (key, "param-")) - return FALSE; - - return g_hash_table_contains (sa->secrets, key + 6); -} - -static void -mcd_storage_make_secret (McdStorage *self, - const gchar *account, - const gchar *key) -{ - McdStorageAccount *sa; - - g_return_if_fail (MCD_IS_STORAGE (self)); - g_return_if_fail (account != NULL); - g_return_if_fail (key != NULL); - - if (!g_str_has_prefix (key, "param-")) - return; - - DEBUG ("flagging %s parameter %s as secret", account, key + 6); - sa = ensure_account (self, account); - g_hash_table_add (sa->secrets, g_strdup (key + 6)); -} - -static void -make_secret (const McpAccountManager *ma, - const gchar *account, - const gchar *key) -{ - mcd_storage_make_secret (MCD_STORAGE (ma), account, key); -} - static gchar * unique_name (const McpAccountManager *ma, const gchar *manager, @@ -1547,17 +1494,13 @@ update_storage (McdStorage *self, const gchar *account, const gchar *key, GVariant *variant, - const gchar *escaped, - gboolean secret) + const gchar *escaped) { GList *store; gboolean done = FALSE; gboolean parameter = g_str_has_prefix (key, "param-"); McpAccountManager *ma = MCP_ACCOUNT_MANAGER (self); - if (secret) - mcd_storage_make_secret (self, account, key); - /* we're deleting, which is unconditional, no need to check if anyone * * claims this setting for themselves */ if (escaped == NULL) @@ -1582,8 +1525,7 @@ update_storage (McdStorage *self, } else if (variant != NULL && parameter && mcp_account_storage_set_parameter (plugin, ma, account, key + 6, - variant, - secret ? MCP_PARAMETER_FLAG_SECRET : MCP_PARAMETER_FLAG_NONE)) + variant, MCP_PARAMETER_FLAG_NONE)) { done = TRUE; DEBUG ("MCP:%s -> store parameter %s.%s", pn, account, key); @@ -1700,7 +1642,7 @@ mcd_storage_set_attribute (McdStorage *self, if (value != NULL) escaped = mcd_keyfile_escape_value (value); - update_storage (self, account, attribute, new_v, escaped, FALSE); + update_storage (self, account, attribute, new_v, escaped); g_free (escaped); updated = TRUE; } @@ -1715,8 +1657,6 @@ mcd_storage_set_attribute (McdStorage *self, * @account: the unique name of an account * @parameter: the name of the parameter, e.g. "account" * @value: the value to be stored (or %NULL to erase it) - * @secret: whether the value is confidential (might get stored in the - * keyring, for example) * * Copies and stores the supplied @value (or removes it if %NULL) in the * internal cache. @@ -1731,8 +1671,7 @@ gboolean mcd_storage_set_parameter (McdStorage *self, const gchar *account, const gchar *parameter, - const GValue *value, - gboolean secret) + const GValue *value) { GVariant *old_v; GVariant *new_v = NULL; @@ -1775,7 +1714,7 @@ mcd_storage_set_parameter (McdStorage *self, g_variant_ref (new_v)); g_snprintf (key, sizeof (key), "param-%s", parameter); - update_storage (self, account, key, new_v, new_escaped, secret); + update_storage (self, account, key, new_v, new_escaped); return TRUE; } @@ -2279,8 +2218,6 @@ plugin_iface_init (McpAccountManagerIface *iface, iface->set_value = set_value; iface->set_attribute = mcpa_set_attribute; iface->set_parameter = mcpa_set_parameter; - iface->is_secret = is_secret; - iface->make_secret = make_secret; iface->unique_name = unique_name; iface->identify_account_async = identify_account_async; iface->identify_account_finish = identify_account_finish; diff --git a/src/mcd-storage.h b/src/mcd-storage.h index e4408451..930b04b1 100644 --- a/src/mcd-storage.h +++ b/src/mcd-storage.h @@ -88,8 +88,7 @@ gboolean mcd_storage_set_attribute (McdStorage *storage, gboolean mcd_storage_set_parameter (McdStorage *storage, const gchar *account, const gchar *parameter, - const GValue *value, - gboolean secret); + const GValue *value); gchar *mcd_storage_create_account (McdStorage *storage, const gchar *provider, |