diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-05-05 17:13:00 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-05-05 17:13:00 +0100 |
commit | c895b0414278dc79d749cd5a13974ff6d6d4b80a (patch) | |
tree | 9cb67242aa814df79c294de4000370252478cc74 /plugins | |
parent | 8f2a8cbc424d6ac6bb0b55d3a973b568aaf9ccf4 (diff) |
mcp_dbus_channel_acl_authorised: redo API in terms of McpDispatchOperation
This vastly simplifies both the caller (McdDispatchOperation) and the
plugin.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mcp-dbus-aegis-acl.c | 39 |
1 files changed, 8 insertions, 31 deletions
diff --git a/plugins/mcp-dbus-aegis-acl.c b/plugins/mcp-dbus-aegis-acl.c index c2b8d0fd..86233e7e 100644 --- a/plugins/mcp-dbus-aegis-acl.c +++ b/plugins/mcp-dbus-aegis-acl.c @@ -36,7 +36,7 @@ #include <telepathy-glib/util.h> #include <telepathy-glib/defs.h> -#include "mcp-dbus-aegis-acl.h" +#include <mission-control-plugins/mission-control-plugins.h> #include <sys/types.h> #include <sys/creds.h> @@ -304,42 +304,19 @@ cm_is_restricted (const gchar *cm_name) } static gboolean -channels_are_filtered (const GPtrArray *channels) -{ - guint i; - gboolean filtered = FALSE; - - for (i = 0; !filtered && i < channels->len; i++) - { - gchar *manager = NULL; - TpChannel *channel = g_ptr_array_index (channels, i); - TpConnection *connection = tp_channel_borrow_connection (channel); - - if (tp_connection_parse_object_path (connection, NULL, &manager)) - { - filtered = cm_is_restricted (manager); - g_free (manager); - } - } - - return filtered; -} - -static gboolean -channel_authorised (const McpDBusChannelAcl *self, - const TpDBusDaemon *dbus, - const TpProxy *recipient, - const GPtrArray *channels) +channel_authorised (McpDBusChannelAcl *self, + TpProxy *recipient, + McpDispatchOperation *dispatch_op) { gboolean ok = TRUE; + const gchar *manager = mcp_dispatch_operation_get_cm_name (dispatch_op); - if (channels_are_filtered (channels)) + if (cm_is_restricted (manager)) { pid_t pid = 0; GError *error = NULL; - const gchar *name = tp_proxy_get_bus_name ((TpProxy *) recipient); - DBusGConnection *dgc = - tp_proxy_get_dbus_connection ((TpProxy *) recipient); + const gchar *name = tp_proxy_get_bus_name (recipient); + DBusGConnection *dgc = tp_proxy_get_dbus_connection (recipient); DBusGProxy *proxy = dbus_g_proxy_new_for_name (dgc, DBUS_SERVICE_DBUS, |