From 239ca8387810e9aaad81ed078281fc3d9692c9a2 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 30 Jan 2014 13:06:56 +0000 Subject: [PATCH] Remove A.I.ExternalPasswordStorage, CM.I.AccountStorage Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33485 Bug: https://bugs.freedesktop.org/show_bug.cgi?id=44512 Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69600 --- src/Makefile.am | 6 - src/mcd-account-priv.h | 5 - src/mcd-account.c | 304 --------------------- src/mcd.xml | 4 - tests/twisted/mctest.py | 11 +- ...Account_Interface_External_Password_Storage.xml | 58 ---- ...onnection_Manager_Interface_Account_Storage.xml | 120 -------- xml/Makefile.am | 2 - xml/nmc5.xml | 4 - 9 files changed, 2 insertions(+), 512 deletions(-) delete mode 100644 xml/Account_Interface_External_Password_Storage.xml delete mode 100644 xml/Connection_Manager_Interface_Account_Storage.xml diff --git a/src/Makefile.am b/src/Makefile.am index 22b1bbf..67ba040 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -26,22 +26,18 @@ mc_headers = \ mcd-storage.h mc_gen_headers = \ - _gen/cli-Connection_Manager_Interface_Account_Storage.h \ _gen/enums.h \ _gen/gtypes.h \ _gen/interfaces.h \ - _gen/svc-Account_Interface_External_Password_Storage.h \ $(NULL) nodist_libmcd_convenience_la_SOURCES = \ - _gen/cli-Connection_Manager_Interface_Account_Storage-body.h \ _gen/gtypes-body.h \ _gen/interfaces-body.h \ _gen/register-dbus-glib-marshallers-body.h \ _gen/signals-marshal.c \ _gen/signals-marshal.h \ _gen/signals-marshal.list \ - _gen/svc-Account_Interface_External_Password_Storage.c \ mcd-enum-types.c \ mcd-enum-types.h \ $(mc_gen_headers) @@ -53,8 +49,6 @@ BUILT_SOURCES = \ CLEANFILES = \ $(BUILT_SOURCES) \ - _gen/cli-Connection_Manager_Interface_Account_Storage-gtk-doc.h \ - _gen/svc-Account_Interface_External_Password_Storage-gtk-doc.h \ _gen/gtypes-gtk-doc.h \ $(NULL) diff --git a/src/mcd-account-priv.h b/src/mcd-account-priv.h index cf682f2..269feb6 100644 --- a/src/mcd-account-priv.h +++ b/src/mcd-account-priv.h @@ -35,11 +35,6 @@ #include -/* auto-generated stubs */ -#include "_gen/svc-Account_Interface_External_Password_Storage.h" - -#include "_gen/cli-Connection_Manager_Interface_Account_Storage.h" - G_GNUC_INTERNAL void _mcd_account_maybe_autoconnect (McdAccount *account); G_GNUC_INTERNAL void _mcd_account_connect (McdAccount *account, GHashTable *params); diff --git a/src/mcd-account.c b/src/mcd-account.c index 28e3602..948b5fb 100644 --- a/src/mcd-account.c +++ b/src/mcd-account.c @@ -47,7 +47,6 @@ #include "_gen/interfaces.h" #include "_gen/enums.h" #include "_gen/gtypes.h" -#include "_gen/cli-Connection_Manager_Interface_Account_Storage-body.h" #define MC_OLD_AVATAR_FILENAME "avatar.bin" @@ -62,14 +61,10 @@ static void account_avatar_iface_init (TpSvcAccountInterfaceAvatarClass *iface, static void account_storage_iface_init ( TpSvcAccountInterfaceStorageClass *iface, gpointer iface_data); -static void account_external_password_storage_iface_init ( - McSvcAccountInterfaceExternalPasswordStorageClass *iface, - gpointer iface_data); static const McdDBusProp account_properties[]; static const McdDBusProp account_avatar_properties[]; static const McdDBusProp account_storage_properties[]; -static const McdDBusProp account_external_password_storage_properties[]; static const McdInterfaceData account_interfaces[] = { MCD_IMPLEMENT_IFACE (tp_svc_account_get_type, account, TP_IFACE_ACCOUNT), @@ -82,10 +77,6 @@ static const McdInterfaceData account_interfaces[] = { MCD_IMPLEMENT_IFACE (tp_svc_account_interface_addressing_get_type, account_addressing, TP_IFACE_ACCOUNT_INTERFACE_ADDRESSING), - MCD_IMPLEMENT_OPTIONAL_IFACE ( - mc_svc_account_interface_external_password_storage_get_type, - account_external_password_storage, - MC_IFACE_ACCOUNT_INTERFACE_EXTERNAL_PASSWORD_STORAGE), { G_TYPE_INVALID, } }; @@ -484,100 +475,6 @@ manager_ready_check_params_cb (McdAccount *account, mcd_account_loaded (account); } -static void -account_external_password_storage_get_accounts_cb (TpProxy *cm, - const GValue *value, - const GError *in_error, - gpointer user_data, - GObject *self) -{ - McdAccount *account = MCD_ACCOUNT (self); - const char *account_id = user_data; - GHashTable *map, *props; - - if (in_error != NULL) - { - DEBUG ("Failed to get Account property: %s", in_error->message); - return; - } - - g_return_if_fail (G_VALUE_HOLDS (value, MC_HASH_TYPE_ACCOUNT_FLAGS_MAP)); - - map = g_value_get_boxed (value); - - account->priv->password_saved = - GPOINTER_TO_UINT (g_hash_table_lookup (map, account_id)) & - MC_ACCOUNT_FLAG_CREDENTIALS_STORED; - - DEBUG ("PasswordSaved = %u", account->priv->password_saved); - - /* emit the changed signal */ - props = tp_asv_new ( - "PasswordSaved", G_TYPE_BOOLEAN, account->priv->password_saved, - NULL); - - tp_svc_dbus_properties_emit_properties_changed (account, - MC_IFACE_ACCOUNT_INTERFACE_EXTERNAL_PASSWORD_STORAGE, - props, - NULL); - - g_hash_table_unref (props); -} - -static void -account_setup_identify_account_cb (TpProxy *protocol, - const char *account_id, - const GError *in_error, - gpointer user_data, - GObject *self) -{ - McdAccount *account = MCD_ACCOUNT (self); - TpConnectionManager *cm = mcd_account_get_cm (account); - - if (in_error != NULL) - { - DEBUG ("Error identifying account: %s", in_error->message); - return; - } - - DEBUG ("Identified account as %s", account_id); - - /* look up the current value of the CM.I.AS.Accounts property - * and monitor future changes */ - tp_cli_dbus_properties_call_get (cm, -1, - MC_IFACE_CONNECTION_MANAGER_INTERFACE_ACCOUNT_STORAGE, - "Accounts", - account_external_password_storage_get_accounts_cb, - g_strdup (account_id), g_free, G_OBJECT (account)); -} - -static void -account_external_password_storage_properties_changed_cb (TpProxy *cm, - const char *iface, - GHashTable *changed_properties, - const char **invalidated_properties, - gpointer user_data, - GObject *self) -{ - McdAccount *account = MCD_ACCOUNT (self); - TpProtocol *protocol = tp_connection_manager_get_protocol_object ( - TP_CONNECTION_MANAGER (cm), account->priv->protocol_name); - GHashTable *params; - - if (tp_strdiff (iface, - MC_IFACE_CONNECTION_MANAGER_INTERFACE_ACCOUNT_STORAGE)) - return; - - /* look up account identity so we can look up our value in - * the Accounts map */ - params = _mcd_account_dup_parameters (account); - tp_cli_protocol_call_identify_account (protocol, -1, params, - account_setup_identify_account_cb, - NULL, NULL, G_OBJECT (account)); - - g_hash_table_unref (params); -} - static void on_manager_ready (McdManager *manager, const GError *error, gpointer user_data) { @@ -590,39 +487,8 @@ static void on_manager_ready (McdManager *manager, const GError *error, } else { - TpConnectionManager *cm = mcd_manager_get_tp_proxy (manager); - mcd_account_check_parameters (account, manager_ready_check_params_cb, NULL); - - /* determine if we support Acct.I.ExternalPasswordStorage */ - if (tp_proxy_has_interface_by_id (cm, - MC_IFACE_QUARK_CONNECTION_MANAGER_INTERFACE_ACCOUNT_STORAGE)) - { - TpProtocol *protocol = tp_connection_manager_get_protocol_object ( - cm, account->priv->protocol_name); - GHashTable *params; - - DEBUG ("CM %s has CM.I.AccountStorage iface", - mcd_manager_get_name (manager)); - - mcd_dbus_activate_optional_interface ( - TP_SVC_DBUS_PROPERTIES (account), - MC_TYPE_SVC_ACCOUNT_INTERFACE_EXTERNAL_PASSWORD_STORAGE); - - /* look up account identity so we can look up our value in - * the Accounts map */ - params = _mcd_account_dup_parameters (account); - tp_cli_protocol_call_identify_account (protocol, -1, params, - account_setup_identify_account_cb, - NULL, NULL, G_OBJECT (account)); - - tp_cli_dbus_properties_connect_to_properties_changed (cm, - account_external_password_storage_properties_changed_cb, - NULL, NULL, G_OBJECT (account), NULL); - - g_hash_table_unref (params); - } } } @@ -665,32 +531,6 @@ get_old_account_data_path (McdAccountPrivate *priv) return g_build_filename (base, priv->unique_name, NULL); } -static void -account_delete_identify_account_cb (TpProxy *protocol, - const char *account_id, - const GError *in_error, - gpointer user_data, - GObject *self) -{ - McdAccount *account = MCD_ACCOUNT (self); - TpConnectionManager *cm = mcd_account_get_cm (account); - - if (in_error != NULL) - { - DEBUG ("Error identifying account: %s", in_error->message); - } - else - { - DEBUG ("Identified account as %s", account_id); - - mc_cli_connection_manager_interface_account_storage_call_remove_account ( - cm, -1, account_id, - NULL, NULL, NULL, NULL); - } - - g_object_unref (account); -} - static TpStorageRestrictionFlags mcd_account_get_storage_restrictions ( McdAccount *account); @@ -704,7 +544,6 @@ mcd_account_delete_async (McdAccount *account, gchar *data_dir_str; GError *error = NULL; const gchar *name = mcd_account_get_unique_name (account); - TpConnectionManager *cm = mcd_account_get_cm (account); GTask *task; task = g_task_new (account, NULL, callback, user_data); @@ -725,29 +564,6 @@ mcd_account_delete_async (McdAccount *account, return; } - /* If the CM implements CM.I.AccountStorage, we need to tell the CM - * to forget any account credentials it knows. - * - * FIXME: put this in the main flow rather than doing it async and - * throwing away its result? */ - if (tp_proxy_has_interface_by_id (cm, - MC_IFACE_QUARK_CONNECTION_MANAGER_INTERFACE_ACCOUNT_STORAGE)) - { - TpProtocol *protocol; - GHashTable *params; - - /* identify the account */ - protocol = tp_connection_manager_get_protocol_object (cm, - account->priv->protocol_name); - params = _mcd_account_dup_parameters (account); - - tp_cli_protocol_call_identify_account (protocol, -1, params, - account_delete_identify_account_cb, - NULL, NULL, g_object_ref (account)); - - g_hash_table_unref (params); - } - /* got to turn the account off before removing it, otherwise we can * * end up with an orphaned CM holding the account online */ if (!_mcd_account_set_enabled (account, FALSE, FALSE, @@ -2240,113 +2056,6 @@ account_storage_iface_init (TpSvcAccountInterfaceStorageClass *iface, } static void -get_password_saved (TpSvcDBusProperties *self, - const gchar *name, - GValue *value) -{ - McdAccount *account = MCD_ACCOUNT (self); - - g_assert_cmpstr (name, ==, "PasswordSaved"); - - g_value_init (value, G_TYPE_BOOLEAN); - g_value_set_boolean (value, account->priv->password_saved); -} - -static const McdDBusProp account_external_password_storage_properties[] = { - { "PasswordSaved", NULL, get_password_saved }, - { 0 }, -}; - -static void -account_external_password_storage_forget_credentials_cb (TpProxy *cm, - const GError *in_error, - gpointer user_data, - GObject *self) -{ - DBusGMethodInvocation *context = user_data; - - if (in_error != NULL) - { - dbus_g_method_return_error (context, in_error); - return; - } - - mc_svc_account_interface_external_password_storage_return_from_forget_password (context); -} - -static void -account_external_password_storage_identify_account_cb (TpProxy *protocol, - const char *account_id, - const GError *in_error, - gpointer user_data, - GObject *self) -{ - McdAccount *account = MCD_ACCOUNT (self); - DBusGMethodInvocation *context = user_data; - TpConnectionManager *cm = mcd_account_get_cm (account); - - if (in_error != NULL) - { - dbus_g_method_return_error (context, in_error); - return; - } - - DEBUG ("Identified account as %s", account_id); - - mc_cli_connection_manager_interface_account_storage_call_forget_credentials ( - cm, -1, account_id, - account_external_password_storage_forget_credentials_cb, - context, NULL, self); -} - -static void -account_external_password_storage_forget_password ( - McSvcAccountInterfaceExternalPasswordStorage *self, - DBusGMethodInvocation *context) -{ - McdAccount *account = MCD_ACCOUNT (self); - TpConnectionManager *cm = mcd_account_get_cm (account); - TpProtocol *protocol; - GHashTable *params; - - /* do we support the interface */ - if (!tp_proxy_has_interface_by_id (cm, - MC_IFACE_QUARK_CONNECTION_MANAGER_INTERFACE_ACCOUNT_STORAGE)) - { - GError *error = g_error_new (TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, - "CM for this Account does not implement AccountStorage iface"); - - dbus_g_method_return_error (context, error); - g_error_free (error); - - return; - } - - /* identify the account */ - protocol = tp_connection_manager_get_protocol_object (cm, - account->priv->protocol_name); - params = _mcd_account_dup_parameters (account); - - tp_cli_protocol_call_identify_account (protocol, -1, params, - account_external_password_storage_identify_account_cb, - context, NULL, G_OBJECT (self)); - - g_hash_table_unref (params); -} - -static void -account_external_password_storage_iface_init ( - McSvcAccountInterfaceExternalPasswordStorageClass *iface, - gpointer iface_data) -{ -#define IMPLEMENT(x) \ - mc_svc_account_interface_external_password_storage_implement_##x (\ - iface, account_external_password_storage_##x) - IMPLEMENT (forget_password); -#undef IMPLEMENT -} - -static void properties_iface_init (TpSvcDBusPropertiesClass *iface, gpointer iface_data) { #define IMPLEMENT(x) tp_svc_dbus_properties_implement_##x (\ @@ -3657,16 +3366,6 @@ _mcd_account_constructed (GObject *object) } static void -mcd_account_add_signals (TpProxy *self, - guint quark, - DBusGProxy *proxy, - gpointer data) -{ - mc_cli_Connection_Manager_Interface_Account_Storage_add_signals (self, - quark, proxy, data); -} - -static void mcd_account_class_init (McdAccountClass * klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -3731,9 +3430,6 @@ mcd_account_class_init (McdAccountClass * klass) G_TYPE_NONE, 1, G_TYPE_STRING); account_ready_quark = g_quark_from_static_string ("mcd_account_load"); - - tp_proxy_or_subclass_hook_on_interface_add (TP_TYPE_CONNECTION_MANAGER, - mcd_account_add_signals); } static void diff --git a/src/mcd.xml b/src/mcd.xml index 87a8fbb..29157ac 100644 --- a/src/mcd.xml +++ b/src/mcd.xml @@ -4,8 +4,4 @@ Copyright (C) 2008 Nokia Corporation - - - - diff --git a/tests/twisted/mctest.py b/tests/twisted/mctest.py index 2229525..549a742 100644 --- a/tests/twisted/mctest.py +++ b/tests/twisted/mctest.py @@ -1000,15 +1000,13 @@ class SimulatedClient(object): class SimulatedConnectionManager(object): def __init__(self, q, bus, cm_name='fakecm', - protocol_names=['fakeprotocol'], - has_account_storage=False): + protocol_names=['fakeprotocol']): self.q = q self.bus = bus self.cm_name = cm_name self.bus_name = '.'.join([cs.CM, cm_name]) self._bus_name_ref = dbus.service.BusName(self.bus_name, self.bus) self.object_path = '/' + self.bus_name.replace('.', '/') - self.has_account_storage = has_account_storage self.protocol_names = list(protocol_names) q.add_dbus_method_impl(self.GetAll_CM, @@ -1117,12 +1115,7 @@ class SimulatedConnectionManager(object): return ret def get_interfaces(self): - ret = dbus.Array([], signature='s') - - if self.has_account_storage: - ret.append(cs.CM_IFACE_ACCOUNT_STORAGE) - - return ret + return dbus.Array([], signature='s') def GetAll_CM(self, e): self.q.dbus_return(e.message, { diff --git a/xml/Account_Interface_External_Password_Storage.xml b/xml/Account_Interface_External_Password_Storage.xml deleted file mode 100644 index 5bd1bfc..0000000 --- a/xml/Account_Interface_External_Password_Storage.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - Copyright © 2011 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 Street, Fifth Floor, Boston, MA - 02110-1301, USA.

-
- - - (draft 1) - - - -

An interface for Accounts whose passwords are stored externally and - SHOULD NOT be stored by either the - AccountManager nor any - ServerAuthentication - handler.

- -

This interface SHOULD only appear on accounts for which the - related Connection Manager implements - ConnectionManager.Interface.AccountStorage.DRAFT.

-
- - - - Clears any saved password associated with this account. - - - - - -

Indicates whether the account has a saved password or not.

- -

Change notification for this property is provided by the - standard D-Bus PropertiesChanged signal.

-
-
- -
-
diff --git a/xml/Connection_Manager_Interface_Account_Storage.xml b/xml/Connection_Manager_Interface_Account_Storage.xml deleted file mode 100644 index 2f4f4bf..0000000 --- a/xml/Connection_Manager_Interface_Account_Storage.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - Copyright © 2011 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 Street, Fifth Floor, Boston, MA - 02110-1301, USA.

-
- - - (draft 1) - - - -

An interface for connection managers that store account details - internally. At the moment this consists only of storing an account's - credentials, but other functionality may be added in the future.

- -

Account objects - representing accounts on a connection manager that implements this - interface should implement the - ExternalPasswordStorage.DRAFT - interface.

-
- - - - A set of flags representing the status of the Account stored in the - Connection Manager. - - - - - The associated account has its authentication credentials (password) - stored in the connection manager - - - - - - A mapping from Account_Ids to account flags. - - - - - - - -

The set of Accounts stored in this Connection Manager, and flags - indicating their status.

- -

Change notification for this property is provided by the standard - D-Bus PropertiesChanged signal.

-
-
- - - - Clears any saved credentials associated with the specified Account_Id. - Any other saved data related to the account will be unaffected. - - - - - An account id as returned from - Protocol.IdentifyAccount. - - - - - - - The account id is invalid. - - - - - - - - Completely removes all data associated with an account from the - connection manager's internal storage. - - - - - An account id as returned from - Protocol.IdentifyAccount. - - - - - - - The account id is invalid. - - - - - -
-
diff --git a/xml/Makefile.am b/xml/Makefile.am index 9c6ae2f..b43d81c 100644 --- a/xml/Makefile.am +++ b/xml/Makefile.am @@ -5,8 +5,6 @@ DROP_NAMESPACE = sed -e 's@xmlns:tp="http://telepathy\.freedesktop\.org/wiki/Dbu DROP_TPTYPE = sed -e 's@tp:type="[^"]*"@@g' SPECS = \ - Account_Interface_External_Password_Storage.xml \ - Connection_Manager_Interface_Account_Storage.xml \ $(NULL) diff --git a/xml/nmc5.xml b/xml/nmc5.xml index c966870..29157ac 100644 --- a/xml/nmc5.xml +++ b/xml/nmc5.xml @@ -4,8 +4,4 @@ Copyright (C) 2008 Nokia Corporation - - - - -- 1.9.rc1