[telepathy-mission-control/master] McdDispatcher: get_interfaces_cb: check whether handlers have BypassApproval
Simon McVittie
simon.mcvittie at collabora.co.uk
Thu May 7 03:37:12 PDT 2009
Previously, only handlers with a .client file could bypass approval. Oops.
Also note some problems to come back to later.
---
src/mcd-dispatcher.c | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 92b0a91..01cb071 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -1686,6 +1686,35 @@ parse_client_filter (GKeyFile *file, const gchar *group)
}
static void
+get_bypass_approval_cb (TpProxy *proxy,
+ const GValue *value,
+ const GError *error,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ McdClient *client = user_data;
+
+ if (error != NULL)
+ {
+ DEBUG ("error getting BypassApproval for client %s: %s #%d: %s",
+ tp_proxy_get_object_path (proxy),
+ g_quark_to_string (error->domain), error->code, error->message);
+ client->bypass_approver = FALSE;
+ return;
+ }
+
+ if (!G_VALUE_HOLDS_BOOLEAN (value))
+ {
+ DEBUG ("wrong type for BypassApproval on client %s: %s",
+ tp_proxy_get_object_path (proxy), G_VALUE_TYPE_NAME (value));
+ client->bypass_approver = FALSE;
+ return;
+ }
+
+ client->bypass_approver = g_value_get_boolean (value);
+}
+
+static void
get_channel_filter_cb (TpProxy *proxy,
const GValue *out_Value,
const GError *error,
@@ -1704,6 +1733,8 @@ get_channel_filter_cb (TpProxy *proxy,
return;
}
+ /* FIXME: if the GValue isn't of the right type, don't crash */
+
filters = g_value_get_boxed (out_Value);
for (i = 0 ; i < filters->len ; i++)
@@ -1813,6 +1844,10 @@ get_interfaces_cb (TpProxy *proxy,
arr++;
}
+ /* FIXME: refactor this stuff to use GetAll (also, I suspect it has a
+ * use-after-free if the client disappears after the D-Bus method call,
+ * but before we get a response) */
+
client_add_interface_by_id (client);
if (client->interfaces & MCD_CLIENT_APPROVER)
{
@@ -1825,6 +1860,10 @@ get_interfaces_cb (TpProxy *proxy,
{
tp_cli_dbus_properties_call_get
(client->proxy, -1, MC_IFACE_CLIENT_HANDLER,
+ "BypassApproval", get_bypass_approval_cb,
+ client, NULL, G_OBJECT (self));
+ tp_cli_dbus_properties_call_get
+ (client->proxy, -1, MC_IFACE_CLIENT_HANDLER,
"HandlerChannelFilter", get_channel_filter_cb,
&client->handler_filters, NULL, G_OBJECT (self));
}
--
1.5.6.5
More information about the telepathy-commits
mailing list