summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2010-12-22 16:57:00 +0000
committerJonny Lamb <jonny.lamb@collabora.co.uk>2010-12-22 16:57:00 +0000
commit58b6385f1eeca94b8312fa23dfd72c31756feae2 (patch)
treea2afe6bd39318599801cfea62353b3cd11e0c7b9
parent4e08c42659381c315feda5f3ba7250925c499869 (diff)
all: remove gnome-keyring supportbye-bye-keyring
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am1
-rwxr-xr-xautogen.sh2
-rw-r--r--configure.ac34
-rw-r--r--mission-control-plugins/account-storage.c5
-rw-r--r--src/Makefile.am8
-rw-r--r--src/mcd-account-manager-default.c359
-rw-r--r--src/mcd-storage.c9
-rw-r--r--tests/Makefile.am15
-rw-r--r--tests/account-store-default.c139
-rw-r--r--tests/account-store.c35
-rw-r--r--tests/keyring-command.c172
-rw-r--r--tests/twisted/Makefile.am9
-rw-r--r--tests/twisted/account-storage/default-keyring-storage.py228
-rw-r--r--tests/twisted/mc-debug-server.c26
-rw-r--r--tests/twisted/tools/exec-with-log.sh.in6
16 files changed, 5 insertions, 1044 deletions
diff --git a/.gitignore b/.gitignore
index 7003d263..e06ac457 100644
--- a/.gitignore
+++ b/.gitignore
@@ -74,7 +74,6 @@ tags
TAGS
/telepathy-mission-control-5*
/tests/account-store
-/tests/keyring-command
/tests/test-*
tests/mc-client
tests/twisted/with-session-bus-*.dbus-monitor-logs
diff --git a/Makefile.am b/Makefile.am
index 27bde660..699d8ff7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,7 +22,6 @@ endif
DISTCHECK_CONFIGURE_FLAGS = \
--enable-gtk-doc \
- --disable-gnome-keyring \
--disable-mcd-plugins
maintainer-upload-release: _maintainer-upload-release-local
diff --git a/autogen.sh b/autogen.sh
index 8c0315cc..5f87ac01 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -31,7 +31,7 @@ for arg in $*; do
esac
done
-default_args="--enable-gtk-doc --enable-mcd-plugins --enable-gnome-keyring=auto"
+default_args="--enable-gtk-doc --enable-mcd-plugins"
if test $run_configure = true; then
echo "Running ./configure $default_args $*"
diff --git a/configure.ac b/configure.ac
index c09e0d92..57e39ffe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -252,40 +252,6 @@ AC_ARG_ENABLE(aegis,
AM_CONDITIONAL(ENABLE_AEGIS, [test x$aegis_enabled = xyes])
-keyring_enabled="no"
-AC_MSG_CHECKING(whether to build with gnome-keyring support)
-AC_ARG_ENABLE(gnome-keyring,
- [ --enable-gnome-keyring build with gnome-keyring support. default=no],
- [
- AC_MSG_RESULT(${enableval})
- keyring_enabled="${enableval}"
- ],
- [
- AC_MSG_RESULT(no)
- keyring_enabled="no"
- ]
-)
-
-PKG_PROG_PKG_CONFIG()
-
-if test "x$keyring_enabled" = xauto
-then
- PKG_CHECK_EXISTS([gnome-keyring-1], [keyring_enabled=yes],
- [keyring_enabled=no])
-fi
-
-AM_CONDITIONAL(ENABLE_GNOME_KEYRING, [test x$keyring_enabled = xyes])
-
-if test "x$keyring_enabled" = xyes
-then
- PKG_CHECK_MODULES([GNOME_KEYRING], [gnome-keyring-1])
- AC_SUBST([GNOME_KEYRING_LIBS])
- AC_SUBST([GNOME_KEYRING_CFLAGS])
- AC_DEFINE([ENABLE_GNOME_KEYRING], [1], [Define whether gnome-keyring support is enabled])
-else
- AC_DEFINE([ENABLE_GNOME_KEYRING], [0], [Define whether gnome-keyring support is enabled])
-fi
-
dnl libaccounts-glib SSO
libaccounts_sso_enabled="no"
AC_MSG_CHECKING(whether to build with libaccounts-glib SSO suport)
diff --git a/mission-control-plugins/account-storage.c b/mission-control-plugins/account-storage.c
index 682c1438..fb48714b 100644
--- a/mission-control-plugins/account-storage.c
+++ b/mission-control-plugins/account-storage.c
@@ -425,11 +425,6 @@ mcp_account_storage_iface_implement_get_restrictions (
* Priorities currently run from MCP_ACCOUNT_STORAGE_PLUGIN_PRIO_DEFAULT
* (the default storage plugin priority) upwards.
*
- * Plugins at a higher priority then MCP_ACCOUNT_STORAGE_PLUGIN_PRIO_KEYRING
- * will have the opportunity to "steal" passwords from the gnome keyring:
- * Plugins at a lower priority than this will not receive secret parameters
- * from MC as the keyring plugin will already have claimed them.
- *
* Plugins at a lower priority than the default plugin will never be asked to
* store any details, although they may still be asked to list them at startup
* time, and may asynchronously notify MC of accounts via the signals above.
diff --git a/src/Makefile.am b/src/Makefile.am
index 9312b62f..ca92ea8a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,10 +8,6 @@ INCLUDES = \
AM_CFLAGS = $(ERROR_CFLAGS)
-if ENABLE_GNOME_KEYRING
-INCLUDES += $(GNOME_KEYRING_CFLAGS)
-endif
-
mc_headers = \
mcd-account.h \
mcd-account-compat.h \
@@ -92,10 +88,6 @@ libmcd_convenience_la_LIBADD = \
$(DBUS_LIBS) \
$(GLIB_LIBS)
-if ENABLE_GNOME_KEYRING
-libmcd_convenience_la_LIBADD += $(GNOME_KEYRING_LIBS)
-endif
-
if ENABLE_LIBACCOUNTS_SSO
libmcd_convenience_la_LIBADD += $(LIBACCOUNTS_SSO_LIBS)
INCLUDES += $(LIBACCOUNTS_SSO_CFLAGS)
diff --git a/src/mcd-account-manager-default.c b/src/mcd-account-manager-default.c
index 7cfdd2aa..dc761421 100644
--- a/src/mcd-account-manager-default.c
+++ b/src/mcd-account-manager-default.c
@@ -29,302 +29,6 @@
#define PLUGIN_DESCRIPTION "GKeyFile (default) account storage backend"
#define INITIAL_CONFIG "# Telepathy accounts\n"
-#if ENABLE_GNOME_KEYRING
-#include <gnome-keyring.h>
-
-GnomeKeyringPasswordSchema keyring_schema =
- { GNOME_KEYRING_ITEM_GENERIC_SECRET,
- { { "account", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
- { "param", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
- { NULL, 0 } } };
-
-typedef struct
-{
- gchar *account;
- gchar *name;
- gboolean set;
-} KeyringSetData;
-
-static void
-_keyring_set_cb (GnomeKeyringResult result,
- gpointer data)
-{
- KeyringSetData *ksd = data;
-
- if (result != GNOME_KEYRING_RESULT_OK)
- g_warning ("failed to save %s.%s : %s", ksd->account, ksd->name,
- gnome_keyring_result_to_message (result));
- else
- DEBUG ("%s %s.%s in gnome keyring",
- ksd->set ? "saved" : "deleted",
- ksd->account,
- ksd->name);
-
- g_free (ksd->account);
- g_free (ksd->name);
- g_slice_free(KeyringSetData, ksd);
-}
-
-static void
-_delete_from_keyring (const McpAccountStorage *self,
- const McpAccountManager *am,
- const gchar *account,
- const gchar *key)
-{
- McdAccountManagerDefault *amd = MCD_ACCOUNT_MANAGER_DEFAULT (self);
-
- if (key == NULL)
- {
- /* flag the whole account as purged */
- gchar *removed = g_strdup (account);
- g_hash_table_insert (amd->removed_accounts, removed, removed);
- }
- else
- {
- /* remember to forget this one param */
- g_key_file_set_value (amd->removed, account, key, "");
- }
-}
-
-static void
-_keyring_remove_account (const McpAccountStorage *self,
- const McpAccountManager *am,
- const gchar *account)
-{
- GList *i;
- GList *items;
- GnomeKeyringAttributeList *match = gnome_keyring_attribute_list_new ();
- GnomeKeyringResult ok;
-
- gnome_keyring_attribute_list_append_string (match, "account", account);
-
- ok = gnome_keyring_find_items_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
- match, &items);
-
- if (ok != GNOME_KEYRING_RESULT_OK)
- goto finished;
-
- for (i = items; i != NULL; i = g_list_next (i))
- {
- GnomeKeyringFound *found = i->data;
- gnome_keyring_item_delete_sync (found->keyring, found->item_id);
- }
-
- finished:
- gnome_keyring_attribute_list_free (match);
-}
-
-static void
-_keyring_commit_one (const McdAccountManagerDefault *amd,
- const McpAccountManager *am,
- const gchar *account_name)
-{
- gsize j;
- gsize k;
- GStrv keys = g_key_file_get_keys (amd->secrets, account_name, &k, NULL);
-
- if (keys == NULL)
- k = 0;
-
- for (j = 0; j < k; j++)
- {
- gchar *name = g_strdup_printf ("account: %s; param: %s",
- account_name, keys[j]);
- gchar *val = g_key_file_get_value (amd->secrets,
- account_name, keys[j], NULL);
- gchar *key = keys[j];
- KeyringSetData *ksd = g_slice_new0 (KeyringSetData);
-
- /* for compatibility with old gnome keyring code we must strip *
- * the param- prefix from the name before saving to the keyring */
- if (g_str_has_prefix (key, "param-"))
- key += strlen ("param-");
-
- ksd->account = g_strdup (account_name);
- ksd->name = g_strdup (keys[j]);
- ksd->set = TRUE;
-
- gnome_keyring_store_password (&keyring_schema, NULL,
- name, val, _keyring_set_cb, ksd, NULL,
- "account", account_name,
- "param", key,
- NULL);
-
- g_free (val);
- g_free (name);
- }
-
- g_strfreev (keys);
-}
-
-static void
-_keyring_commit (const McpAccountStorage *self,
- const McpAccountManager *am,
- const gchar *account_name)
-{
- McdAccountManagerDefault *amd = MCD_ACCOUNT_MANAGER_DEFAULT (self);
- gsize n;
- gsize i;
- GStrv accts;
- GHashTableIter iter = { 0 };
- gchar *account = NULL;
-
- if (!gnome_keyring_is_available ())
- return;
-
- /* purge any entirely removed accounts */
- g_hash_table_iter_init (&iter, amd->removed_accounts);
-
- while (g_hash_table_iter_next (&iter, (gpointer *) &account, NULL))
- _keyring_remove_account (self, am, (gchar *) account);
-
- g_hash_table_remove_all (amd->removed_accounts);
-
- /* purge deleted parameters for remaining accounts */
- accts = g_key_file_get_groups (amd->removed, &n);
-
- for (i = 0; i < n; i++)
- {
- gsize j;
- gsize k;
- GStrv keys = g_key_file_get_keys (amd->secrets, accts[i], &k, NULL);
-
- if (keys == NULL)
- k = 0;
-
- for (j = 0; j < k; j++)
- {
- KeyringSetData *ksd = g_slice_new0 (KeyringSetData);
-
- ksd->account = g_strdup (accts[i]);
- ksd->name = g_strdup (keys[j]);
- ksd->set = FALSE;
-
- gnome_keyring_delete_password (&keyring_schema,
- _keyring_set_cb, ksd, NULL,
- "account", accts[i],
- "param", keys[j],
- NULL);
- }
-
- g_strfreev (keys);
- }
-
- g_strfreev (accts);
-
- /* forget about all the purged params completely */
- g_key_file_load_from_data (amd->removed, "#\n", -1, 0, NULL);
-
- if (account_name == NULL)
- {
- /* ok, write out the values for all the accounts we have: */
- accts = g_key_file_get_groups (amd->secrets, &n);
-
- for (i = 0; i < n; i++)
- _keyring_commit_one (amd, am, accts[i]);
-
- g_strfreev (accts);
- }
- else
- {
- _keyring_commit_one (amd, am, account_name);
- }
-}
-
-static void
-_get_secrets_from_keyring (const McpAccountStorage *self,
- const McpAccountManager *am,
- const gchar *account)
-{
- McdAccountManagerDefault *amd = MCD_ACCOUNT_MANAGER_DEFAULT (self);
- GnomeKeyringResult ok = GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON;
- GnomeKeyringAttributeList *match = gnome_keyring_attribute_list_new ();
- GList *items = NULL;
- GList *i;
-
- gnome_keyring_attribute_list_append_string (match, "account", account);
-
- ok = gnome_keyring_find_items_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
- match, &items);
-
- if (ok != GNOME_KEYRING_RESULT_OK)
- goto finished;
-
- for (i = items; i != NULL; i = g_list_next (i))
- {
- gsize j;
- GnomeKeyringFound *entry = i->data;
- GnomeKeyringAttributeList *data = entry->attributes;
-
- for (j = 0; j < data->len; j++)
- {
- GnomeKeyringAttribute *attr =
- &(gnome_keyring_attribute_list_index (data, j));
- const gchar *name = attr->name;
- const gchar *value = NULL;
- const gchar *param = NULL;
-
- switch (attr->type)
- {
- case GNOME_KEYRING_ATTRIBUTE_TYPE_STRING:
- if (g_strcmp0 ("param", name) == 0)
- {
- param = attr->value.string;
- value = entry->secret;
- }
- break;
-
- default:
- g_warning ("Unsupported value type for %s.%s", account, name);
- }
-
- if (param != NULL && value != NULL)
- {
- gchar *key = g_strdup_printf ("param-%s", param);
-
- g_key_file_set_value (amd->secrets, account, key, value);
- mcp_account_manager_parameter_make_secret (am, account, key);
-
- g_free (key);
- }
- }
- }
-
- gnome_keyring_found_list_free (items);
-
- finished:
- gnome_keyring_attribute_list_free (match);
-}
-
-#else
-
-static void
-_delete_from_keyring (const McpAccountStorage *self,
- const McpAccountManager *am,
- const gchar *account,
- const gchar *key)
-{
- return;
-}
-
-static void
-_keyring_commit (const McpAccountStorage *self,
- const McpAccountManager *am,
- const gchar *account_name)
-{
- return;
-}
-
-static void
-_get_secrets_from_keyring (const McpAccountStorage *self,
- const McpAccountManager *am,
- const gchar *account)
-{
- return;
-}
-
-#endif
-
static void account_storage_iface_init (McpAccountStorageIface *,
gpointer);
@@ -404,24 +108,8 @@ _set (const McpAccountStorage *self,
amd->save = TRUE;
-#if ENABLE_GNOME_KEYRING
- /* if we have a keyring, secrets are segregated */
- if (mcp_account_manager_parameter_is_secret (am, account, key))
- g_key_file_set_value (amd->secrets, account, key, val);
- else
- g_key_file_set_value (amd->keyfile, account, key, val);
-
- /* if we removed the account before, it now exists again, so... */
- g_hash_table_remove (amd->removed_accounts, account);
-
- /* likewise the param should no longer be on the deleted list */
- g_key_file_remove_key (amd->removed, account, key, NULL);
-#else
-
g_key_file_set_value (amd->keyfile, account, key, val);
-#endif
-
return TRUE;
}
@@ -437,16 +125,7 @@ _get (const McpAccountStorage *self,
{
gchar *v = NULL;
-#if ENABLE_GNOME_KEYRING
- if (mcp_account_manager_parameter_is_secret (am, account, key))
- v = g_key_file_get_value (amd->secrets, account, key, NULL);
-
- /* fall back to public source if secret was not in keyring */
- if (v == NULL)
- v = g_key_file_get_value (amd->keyfile, account, key, NULL);
-#else
v = g_key_file_get_value (amd->keyfile, account, key, NULL);
-#endif
if (v == NULL)
return FALSE;
@@ -474,28 +153,6 @@ _get (const McpAccountStorage *self,
}
g_strfreev (keys);
-
-#if ENABLE_GNOME_KEYRING
- keys = g_key_file_get_keys (amd->secrets, account, &n, NULL);
-
- if (keys == NULL)
- n = 0;
-
- for (i = 0; i < n; i++)
- {
- gchar *v = g_key_file_get_value (amd->secrets, account, keys[i], NULL);
-
- if (v != NULL)
- {
- mcp_account_manager_set_value (am, account, keys[i], v);
- mcp_account_manager_parameter_make_secret (am, account, keys[i]);
- }
-
- g_free (v);
- }
-
- g_strfreev (keys);
-#endif
}
return TRUE;
@@ -513,7 +170,6 @@ _delete (const McpAccountStorage *self,
{
if (g_key_file_remove_group (amd->keyfile, account, NULL))
amd->save = TRUE;
- _delete_from_keyring (self, am, account, NULL);
}
else
{
@@ -521,14 +177,7 @@ _delete (const McpAccountStorage *self,
GStrv keys;
gboolean save = FALSE;
-#if ENABLE_GNOME_KEYRING
- if (mcp_account_manager_parameter_is_secret (am, account, key))
- save = g_key_file_remove_key (amd->secrets, account, key, NULL);
- else
- save = g_key_file_remove_key (amd->keyfile, account, key, NULL);
-#else
save = g_key_file_remove_key (amd->keyfile, account, key, NULL);
-#endif
if (save)
amd->save = TRUE;
@@ -542,11 +191,6 @@ _delete (const McpAccountStorage *self,
{
g_key_file_remove_group (amd->secrets, account, NULL);
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))
- {
- _delete_from_keyring (self, am, account, key);
}
g_strfreev (keys);
@@ -577,8 +221,6 @@ _commit (const McpAccountStorage *self,
amd->save = !rval;
g_free (data);
- _keyring_commit (self, am, account);
-
return rval;
}
@@ -603,7 +245,6 @@ _list (const McpAccountStorage *self,
for (i = 0; i < n; i++)
{
- _get_secrets_from_keyring (self, am, accounts[i]);
rval = g_list_prepend (rval, g_strdup (accounts[i]));
}
diff --git a/src/mcd-storage.c b/src/mcd-storage.c
index 6ae8c564..cc42282e 100644
--- a/src/mcd-storage.c
+++ b/src/mcd-storage.c
@@ -58,8 +58,7 @@ mcd_storage_get_type (void)
* @account: the unique name of an account
* @key: the key (name) of the parameter or setting
* @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)
+ * @secret: whether the value is confidential
*
* Copies and stores the supplied @value (or removes it if %NULL) to the
* internal cache.
@@ -93,8 +92,7 @@ mcd_storage_set_string (McdStorage *storage,
* @account: the unique name of an account
* @key: the key (name) of the parameter or setting
* @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)
+ * @secret: whether the value is confidential
*
* Copies and stores the supplied @value (or removes it if %NULL) to the
* internal cache.
@@ -129,8 +127,7 @@ mcd_storage_set_value (McdStorage *storage,
* @key: the key (name) of the parameter or setting
* @strv: the string vector to be stored (where %NULL is treated as equivalent
* to an empty vector)
- * @secret: whether the value is confidential (might get stored in the
- * keyring, for example)
+ * @secret: whether the value is confidential
*
* Copies and stores the supplied string vector to the internal cache.
*
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7f6c3996..22e25306 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -10,19 +10,11 @@ INCLUDES = \
AM_CFLAGS = $(ERROR_CFLAGS)
-if ENABLE_GNOME_KEYRING
-INCLUDES += $(GNOME_KEYRING_CFLAGS)
-endif
-
SUBDIRS = . twisted
TEST_EXECUTABLES = test-value-is-same
NON_TEST_EXECUTABLES = account-store
-if ENABLE_GNOME_KEYRING
-NON_TEST_EXECUTABLES += keyring-command
-endif
-
noinst_PROGRAMS = $(TEST_EXECUTABLES) $(NON_TEST_EXECUTABLES)
TESTS = $(TEST_EXECUTABLES)
@@ -38,13 +30,6 @@ account_store_SOURCES = \
account-store-default.c \
account-store-default.h
-if ENABLE_GNOME_KEYRING
-account_store_LDADD += $(GNOME_KEYRING_LIBS)
-
-keyring_command_LDADD = $(GLIB_LIBS) $(GNOME_KEYRING_LIBS)
-keyring_command_SOURCES = keyring-command.c
-endif
-
if ENABLE_LIBACCOUNTS_SSO
account_store_SOURCES += account-store-libaccounts.c account-store-libaccounts.h
account_store_LDADD += $(LIBACCOUNTS_SSO_LIBS)
diff --git a/tests/account-store-default.c b/tests/account-store-default.c
index 464aa986..86da0f62 100644
--- a/tests/account-store-default.c
+++ b/tests/account-store-default.c
@@ -25,120 +25,6 @@
#include "account-store-default.h"
-#if ENABLE_GNOME_KEYRING
-#include <gnome-keyring.h>
-
-GnomeKeyringPasswordSchema keyring_schema =
- { GNOME_KEYRING_ITEM_GENERIC_SECRET,
- { { "account", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
- { "param", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING },
- { NULL, 0 } } };
-
-static gboolean
-_keyring_remove_account (const gchar *acct)
-{
- GList *i;
- GList *items;
- GnomeKeyringAttributeList *match = gnome_keyring_attribute_list_new ();
- GnomeKeyringResult ok;
-
- gnome_keyring_attribute_list_append_string (match, "account", acct);
-
- ok = gnome_keyring_find_items_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
- match, &items);
-
- if (ok != GNOME_KEYRING_RESULT_OK)
- goto finished;
-
- for (i = items; i != NULL; i = g_list_next (i))
- {
- GnomeKeyringFound *found = i->data;
- ok = gnome_keyring_item_delete_sync (found->keyring, found->item_id);
- if (ok != GNOME_KEYRING_RESULT_OK)
- break;
- }
-
- finished:
- gnome_keyring_attribute_list_free (match);
-
- return ok = GNOME_KEYRING_RESULT_OK;
-}
-
-static gchar *
-_get_secret_from_keyring (const gchar *account, const gchar *key)
-{
- GnomeKeyringResult ok = GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON;
- GnomeKeyringAttributeList *match = gnome_keyring_attribute_list_new ();
- GList *items = NULL;
- GList *i;
- gchar *secret;
-
- gnome_keyring_attribute_list_append_string (match, "account", account);
-
- ok = gnome_keyring_find_items_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
- match, &items);
-
- if (ok != GNOME_KEYRING_RESULT_OK)
- goto finished;
-
- for (i = items; i != NULL; i = g_list_next (i))
- {
- gsize j;
- GnomeKeyringFound *entry = i->data;
- GnomeKeyringAttributeList *data = entry->attributes;
-
- for (j = 0; j < data->len; j++)
- {
- GnomeKeyringAttribute *attr =
- &(gnome_keyring_attribute_list_index (data, j));
- const gchar *name = attr->name;
- const gchar *value = NULL;
- const gchar *param = NULL;
-
- switch (attr->type)
- {
- case GNOME_KEYRING_ATTRIBUTE_TYPE_STRING:
- if (g_strcmp0 ("param", name) == 0)
- {
- param = attr->value.string;
- value = entry->secret;
- }
- break;
-
- default:
- g_warning ("Unsupported value type for %s.%s", account, name);
- }
-
- if (param != NULL && value != NULL && g_str_equal (param, key))
- secret = g_strdup (value);
- }
- }
-
- gnome_keyring_found_list_free (items);
-
- finished:
- gnome_keyring_attribute_list_free (match);
-
- return secret;
-}
-
-#else
-
-static gchar *
-_get_secret_from_keyring (const gchar *account,
- const gchar *key)
-{
- return NULL;
-}
-
-static gboolean
-_keyring_remove_account (const gchar *acct)
-{
- return TRUE;
-}
-
-#endif
-
static const gchar *default_config (void)
{
const gchar *base;
@@ -217,10 +103,7 @@ default_get (const gchar *account,
if (g_str_has_prefix (key, "param-"))
pkey = key + strlen("param-");
- value = _get_secret_from_keyring (account, pkey);
-
- if (value == NULL)
- value = g_key_file_get_string (default_keyfile (), account, key, NULL);
+ value = g_key_file_get_string (default_keyfile (), account, key, NULL);
return value;
}
@@ -232,25 +115,6 @@ default_set (const gchar *account,
{
GKeyFile *keyfile = NULL;
-#if ENABLE_GNOME_KEYRING
- if (g_str_equal (key, "param-password"))
- {
- GnomeKeyringResult result = GNOME_KEYRING_RESULT_CANCELLED;
- gchar *name =
- g_strdup_printf ("account: %s; param: %s", account, "password");
-
- result = gnome_keyring_store_password_sync (&keyring_schema, NULL,
- name, value,
- "account", account,
- "param", "password",
- NULL);
-
- g_free (name);
-
- return result == GNOME_KEYRING_RESULT_OK;
- }
-#endif
-
keyfile = default_keyfile ();
if (keyfile == NULL)
@@ -267,7 +131,6 @@ default_delete (const gchar *account)
GKeyFile *keyfile = default_keyfile ();
g_key_file_remove_group (keyfile, account, NULL);
- _keyring_remove_account (account);
return commit_changes ();
}
diff --git a/tests/account-store.c b/tests/account-store.c
index 5483527a..0b1516b1 100644
--- a/tests/account-store.c
+++ b/tests/account-store.c
@@ -85,37 +85,6 @@ const Backend backends[] = {
static void usage (const gchar *name, const gchar *fmt,
...) G_GNUC_NORETURN;
-#if ENABLE_GNOME_KEYRING
-#include <gnome-keyring.h>
-
-static void
-setup_default_keyring (void)
-{
- GnomeKeyringResult result;
-
- g_debug ("Setting default keyring to: %s", g_getenv ("MC_KEYRING_NAME"));
-
- if (g_getenv ("MC_KEYRING_NAME") != NULL)
- {
- const gchar *keyring_name = g_getenv ("MC_KEYRING_NAME");
-
- g_debug ("MC Keyring name: %s", keyring_name);
-
- if ((result = gnome_keyring_set_default_keyring_sync (keyring_name)) ==
- GNOME_KEYRING_RESULT_OK)
- {
- g_debug ("Successfully set up temporary keyring %s for tests",
- keyring_name);
- }
- else
- {
- g_warning ("Failed to set %s as the default keyring: %s",
- keyring_name, gnome_keyring_result_to_message (result));
- }
- }
-}
-#endif
-
int main (int argc, char **argv)
{
int i;
@@ -132,10 +101,6 @@ int main (int argc, char **argv)
g_type_init ();
g_set_application_name (argv[0]);
-#if ENABLE_GNOME_KEYRING
- setup_default_keyring ();
-#endif
-
if (argc < 3)
usage (argv[0], "");
diff --git a/tests/keyring-command.c b/tests/keyring-command.c
deleted file mode 100644
index 640f448a..00000000
--- a/tests/keyring-command.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 8 -*- */
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007-2010 Nokia Corporation
- * Copyright (C) 2010 Collabora Ltd.
- *
- * Contact: Naba Kumar <naba.kumar@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include <glib.h>
-#include <glib/gprintf.h>
-#include <glib-object.h>
-#include <gnome-keyring.h>
-
-
-static gboolean
-create_keyring (gchar *keyring_name)
-{
- GnomeKeyringResult result;
-
- result = gnome_keyring_create_sync (keyring_name, "");
-
- if (result == GNOME_KEYRING_RESULT_OK)
- return TRUE;
-
- g_warning ("Failed to create keyring %s: %s", keyring_name,
- gnome_keyring_result_to_message (result));
-
- return FALSE;
-}
-
-static gchar *
-create_random_keyring (void)
-{
- gchar *keyring_name = NULL;
- GnomeKeyringResult result;
-
- while (TRUE)
- {
- keyring_name = g_strdup_printf ("mc-test-%u", g_random_int ());
-
- result = gnome_keyring_create_sync (keyring_name, "");
-
- if (result == GNOME_KEYRING_RESULT_OK)
- {
- return keyring_name;
- }
- else if (result == GNOME_KEYRING_RESULT_KEYRING_ALREADY_EXISTS)
- {
- g_free (keyring_name);
- keyring_name = NULL;
- continue;
- }
- else
- {
- g_warning ("Failed to create keyring %s: %s", keyring_name,
- gnome_keyring_result_to_message (result));
- g_free (keyring_name);
- return NULL;
- }
- }
-
- g_assert_not_reached ();
-}
-
-static gboolean
-remove_keyring (gchar *keyring_name)
-{
- GnomeKeyringResult result;
-
- result = gnome_keyring_delete_sync (keyring_name);
-
- if (result == GNOME_KEYRING_RESULT_OK)
- {
- return TRUE;
- }
- else
- {
- g_warning ("Failed to remove keyring %s: %s", keyring_name,
- gnome_keyring_result_to_message (result));
- return FALSE;
- }
-}
-
-static void
-show_help (gchar *name)
-{
- g_printf ("%s - utility for creating and removing gnome keyrings\n", name);
- g_printf ("Usage: %s create [KEYRING]\n", name);
- g_printf (" %s remove KEYRING\n", name);
-}
-
-int
-main (int argc, char **argv)
-{
- g_type_init ();
-
- if (argc < 2)
- {
- show_help (argv[0]);
- return 0;
- }
-
- if (!g_strcmp0 (argv[1], "create"))
- {
- if (argc < 3)
- {
- gchar *keyring_name = create_random_keyring ();
-
- if (keyring_name)
- {
- g_printf("%s\n", keyring_name);
- g_free (keyring_name);
- return 0;
- }
- else
- {
- return -1;
- }
- }
- else
- {
- if (create_keyring (argv[2]))
- {
- g_printf("%s\n", argv[2]);
- return 0;
- }
- else
- {
- return -1;
- }
- }
- }
-
- if (!g_strcmp0 (argv[1], "remove"))
- {
- if (argc < 3)
- {
- show_help (argv[0]);
- return -1;
- }
-
- if (remove_keyring (argv[2]))
- {
- return 0;
- }
- else
- {
- return -1;
- }
- }
-
- show_help (argv[0]);
- return -1;
-}
-
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index fd2d610b..aef8c7dd 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -73,7 +73,6 @@ endif
# account-storage/*.py need their own instances.
TWISTED_SPECIAL_BUILD_TESTS = \
account-manager/auto-away.py \
- account-storage/default-keyring-storage.py \
account-storage/diverted-storage.py
TWISTED_SLOW_TESTS = \
@@ -142,10 +141,6 @@ INCLUDES = \
-DMC_DISABLE_DEPRECATED \
-DLIBDIR="@libdir@" -DLIBVERSION="0"
-if ENABLE_GNOME_KEYRING
-INCLUDES += $(GNOME_KEYRING_CFLAGS)
-endif
-
TESTS =
TMPSUFFIX = foo
@@ -166,10 +161,6 @@ BASIC_TESTS_ENVIRONMENT = \
MC_MANAGER_DIR=@abs_top_srcdir@/tests/twisted/telepathy/managers \
G_DEBUG=fatal_criticals
-if ENABLE_GNOME_KEYRING
-BASIC_TESTS_ENVIRONMENT += MC_TEST_GNOME_KEYRING=1
-endif
-
if ENABLE_LIBACCOUNTS_SSO
BASIC_TESTS_ENVIRONMENT += AG_DEBUG=all \
ACCOUNTS=@abs_top_builddir@/tests/twisted/tmp-$(TMPSUFFIX) \
diff --git a/tests/twisted/account-storage/default-keyring-storage.py b/tests/twisted/account-storage/default-keyring-storage.py
deleted file mode 100644
index 5d066d6a..00000000
--- a/tests/twisted/account-storage/default-keyring-storage.py
+++ /dev/null
@@ -1,228 +0,0 @@
-# Copyright (C) 2009-2010 Nokia Corporation
-# Copyright (C) 2009-2010 Collabora Ltd.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-# 02110-1301 USA
-
-import time
-import os
-import os.path
-import signal
-
-import dbus
-import dbus.service
-
-from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
- call_async
-from mctest import exec_test, create_fakecm_account, get_account_manager, \
- get_fakecm_account, make_mc, connect_to_mc, keyfile_read
-import constants as cs
-
-use_keyring = False
-if ('MC_TEST_GNOME_KEYRING' in os.environ and
- os.environ['MC_TEST_GNOME_KEYRING'] == '1'):
- use_keyring = True
-
-def create_keyring():
- if not use_keyring:
- return
-
- keyring = os.popen('../keyring-command create').read()
- if not keyring or keyring.startswith('**'):
- return None
- return keyring[:-1]
-
-def remove_keyring(name):
- if not use_keyring:
- return
-
- os.system('../keyring-command remove ' + name)
-
-def account_store(op, backend, key=None, value=None):
- cmd = [ '../account-store', op, backend,
- 'fakecm/fakeprotocol/dontdivert_40example_2ecom0' ]
- if key:
- cmd.append(key)
- if value:
- cmd.append(value)
-
- lines = os.popen(' '.join(cmd)).read()
- ret = []
- for line in lines.split('\n'):
- if line.startswith('** '):
- continue
-
- if line:
- ret.append(line)
-
- if len(ret) > 0:
- return ret[0]
- else:
- return None
-
-def start_gnome_keyring_daemon(ctl_dir):
- if not use_keyring:
- return
-
- os.chmod(ctl_dir, 0700)
- env = os.popen('gnome-keyring-daemon -d --control-directory=' + ctl_dir).read()
- env_file = open(ctl_dir + '/gnome-keyring-env', 'w')
-
- for line in env.split('\n'):
- if line:
- k, v = line.split('=', 1)
- print "Adding to env: %s=%s" % (k, v)
- os.environ[k] = v
- env_file.write('%s=%s\n' % (k, v))
-
- keyring_name = create_keyring()
- assert keyring_name
- print "Created new keyring name, putting to env", keyring_name
- os.environ['MC_KEYRING_NAME'] = keyring_name
- env_file.write('MC_KEYRING_NAME=%s\n' % keyring_name)
- env_file.close()
-
-def stop_gnome_keyring_daemon():
- if not use_keyring:
- return
-
- keyring_name = os.environ['MC_KEYRING_NAME']
- keyring_daemon_pid = os.environ['GNOME_KEYRING_PID']
-
- if keyring_name:
- print "Removing keyring", keyring_name
- remove_keyring(keyring_name)
-
- if keyring_daemon_pid:
- print "Killing keyring daemon, pid =", keyring_daemon_pid
- os.kill(int(keyring_daemon_pid), 15)
-
-def test(q, bus, mc):
- ctl_dir = os.environ['MC_ACCOUNT_DIR']
- key_file_name = os.path.join(ctl_dir, 'accounts.cfg')
- group = 'fakecm/fakeprotocol/dontdivert_40example_2ecom0'
-
- account_manager, properties, interfaces = connect_to_mc(q, bus, mc)
-
- assert properties.get('ValidAccounts') == [], \
- properties.get('ValidAccounts')
- assert properties.get('InvalidAccounts') == [], \
- properties.get('InvalidAccounts')
-
- params = dbus.Dictionary({"account": "dontdivert@example.com",
- "password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
-
- account_path = account.__dbus_object_path__
-
- # Check the account is correctly created
- properties = account_manager.GetAll(cs.AM,
- dbus_interface=cs.PROPERTIES_IFACE)
- assert properties is not None
- assert properties.get('ValidAccounts') == [account_path], properties
- account_path = properties['ValidAccounts'][0]
- assert isinstance(account_path, dbus.ObjectPath), repr(account_path)
- assert properties.get('InvalidAccounts') == [], properties
-
- account_iface = dbus.Interface(account, cs.ACCOUNT)
- account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
- nokia_compat = dbus.Interface(account, cs.ACCOUNT_IFACE_NOKIA_COMPAT)
-
- # Alter some miscellaneous r/w properties
-
- account_props.Set(cs.ACCOUNT, 'DisplayName', 'Work account')
- account_props.Set(cs.ACCOUNT, 'Icon', 'im-jabber')
- account_props.Set(cs.ACCOUNT, 'Nickname', 'Joe Bloggs')
- nokia_compat.SetHasBeenOnline()
- account_props.Set(cs.ACCOUNT_IFACE_NOKIA_COMPAT,
- 'SecondaryVCardFields', ['x-badger', 'x-mushroom'])
-
- # Restart MC
-
- secret_debug_api = dbus.Interface(bus.get_object(cs.AM, "/"),
- 'org.freedesktop.Telepathy.MissionControl5.RegressionTests')
- secret_debug_api.Abort()
-
- # Make sure MC exits
- q.expect('dbus-signal', signal='NameOwnerChanged',
- predicate=(lambda e:
- e.args[0] == 'org.freedesktop.Telepathy.AccountManager' and
- e.args[2] == ''))
-
- # .. let's check the keyfile
- kf = keyfile_read(key_file_name)
- assert group in kf, kf
- assert kf[group]['manager'] == 'fakecm'
- assert kf[group]['protocol'] == 'fakeprotocol'
- assert kf[group]['param-account'] == params['account'], kf
- assert kf[group]['DisplayName'] == 'Work account', kf
- assert kf[group]['Icon'] == 'im-jabber', kf
- assert kf[group]['Nickname'] == 'Joe Bloggs', kf
- assert kf[group]['HasBeenOnline'] == 'true', kf
- assert kf[group]['SecondaryVCardFields'] == 'x-badger;x-mushroom;', kf
-
- # This works wherever the password is stored
- pwd = account_store('get', 'default', 'param-password')
- assert pwd == params['password'], pwd
-
- # If we're using GNOME keyring, the password should not be in the
- # password file
- if use_keyring:
- assert 'param-password' not in kf[group]
- else:
- assert kf[group]['param-password'] == params['password'], kf
-
- # Reactivate MC
- bus.get_object(cs.MC, "/")
-
- # Wait until it's up
- q.expect('dbus-signal', signal='NameOwnerChanged',
- predicate=(lambda e:
- e.args[0] == 'org.freedesktop.Telepathy.AccountManager' and
- e.args[2] != ''))
-
- mc = make_mc(bus, q.append)
- account_manager, properties, interfaces = connect_to_mc(q, bus, mc)
- account = get_fakecm_account(bus, mc, account_path)
-
- account_iface = dbus.Interface(account, cs.ACCOUNT)
-
- # Delete the account
- assert account_iface.Remove() is None
- account_event, account_manager_event = q.expect_many(
- EventPattern('dbus-signal',
- path=account_path,
- signal='Removed',
- interface=cs.ACCOUNT,
- args=[]
- ),
- EventPattern('dbus-signal',
- path=cs.AM_PATH,
- signal='AccountRemoved',
- interface=cs.AM,
- args=[account_path]
- ),
- )
-
- # Check the account is correctly deleted
- kf = keyfile_read(key_file_name)
- assert group not in kf, kf
-
-
-if __name__ == '__main__':
- ctl_dir = os.environ['MC_ACCOUNT_DIR']
- start_gnome_keyring_daemon(ctl_dir)
- exec_test(test, {}, timeout=10)
- stop_gnome_keyring_daemon()
diff --git a/tests/twisted/mc-debug-server.c b/tests/twisted/mc-debug-server.c
index 3bcbc4d0..d7cdd79f 100644
--- a/tests/twisted/mc-debug-server.c
+++ b/tests/twisted/mc-debug-server.c
@@ -36,10 +36,6 @@
#include <telepathy-glib/debug.h>
#include <telepathy-glib/util.h>
-#if ENABLE_GNOME_KEYRING
-#include <gnome-keyring.h>
-#endif
-
#include "mcd-service.h"
static McdService *mcd = NULL;
@@ -169,9 +165,6 @@ main (int argc, char **argv)
int ret = 1;
GMainLoop *teardown_loop;
guint linger_time = 5;
-#if ENABLE_GNOME_KEYRING
- GnomeKeyringResult result;
-#endif
g_type_init ();
@@ -204,25 +197,6 @@ main (int argc, char **argv)
((TpProxy *) bus_daemon)->dbus_connection);
dbus_connection_add_filter (connection, dbus_filter_function, NULL, NULL);
-#if ENABLE_GNOME_KEYRING
- if (g_getenv ("MC_KEYRING_NAME") != NULL)
- {
- const gchar *keyring_name = g_getenv ("MC_KEYRING_NAME");
-
- if ((result = gnome_keyring_set_default_keyring_sync (keyring_name)) ==
- GNOME_KEYRING_RESULT_OK)
- {
- g_debug ("Successfully set up temporary keyring %s for tests",
- keyring_name);
- }
- else
- {
- g_warning ("Failed to set %s as the default keyring: %s",
- keyring_name, gnome_keyring_result_to_message (result));
- }
- }
-#endif
-
mcd = mcd_service_new ();
/* Listen for suicide notification */
diff --git a/tests/twisted/tools/exec-with-log.sh.in b/tests/twisted/tools/exec-with-log.sh.in
index 0b40a24b..b1472b47 100644
--- a/tests/twisted/tools/exec-with-log.sh.in
+++ b/tests/twisted/tools/exec-with-log.sh.in
@@ -54,12 +54,6 @@ if test "z$MC_EXECUTABLE" = z; then
MC_EXECUTABLE=@abs_top_builddir@/tests/twisted/mc-debug-server
fi
-if test -f "$MC_ACCOUNT_DIR/gnome-keyring-env"; then
- cat "$MC_ACCOUNT_DIR/gnome-keyring-env"
- . "$MC_ACCOUNT_DIR/gnome-keyring-env"
- export GNOME_KEYRING_CONTROL GNOME_KEYRING_PID MC_KEYRING_NAME SSH_AUTH_SOCK
-fi
-
exec @abs_top_builddir@/libtool --mode=execute \
$MISSIONCONTROL_WRAPPER \
$MC_EXECUTABLE