[telepathy-gabble/master] tube-dbus: check if access_control passed to Offer/Accept is valid
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Mon May 25 10:03:21 PDT 2009
---
src/tube-dbus.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/src/tube-dbus.c b/src/tube-dbus.c
index e388fa6..faca1c7 100644
--- a/src/tube-dbus.c
+++ b/src/tube-dbus.c
@@ -1841,6 +1841,25 @@ gabble_tube_dbus_get_interfaces (TpSvcChannel *iface,
}
}
+static gboolean
+gabble_tube_dbus_check_access_control (GabbleTubeDBus *self,
+ guint access_control,
+ GError **error)
+{
+ switch (access_control)
+ {
+ case TP_SOCKET_ACCESS_CONTROL_CREDENTIALS:
+ break;
+
+ default:
+ g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ "%u socket access control is not supported", access_control);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/**
* gabble_tube_dbus_offer_async
*
@@ -1856,6 +1875,13 @@ gabble_tube_dbus_offer_async (GabbleSvcChannelTypeDBusTube *self,
GabbleTubeDBus *tube = GABBLE_TUBE_DBUS (self);
GError *error = NULL;
+ if (!gabble_tube_dbus_check_access_control (tube, access_control, &error))
+ {
+ dbus_g_method_return_error (context, error);
+ g_error_free (error);
+ return;
+ }
+
g_object_set (self, "parameters", parameters, NULL);
if (gabble_tube_dbus_offer (tube, &error))
@@ -1885,6 +1911,13 @@ gabble_tube_dbus_accept_async (GabbleSvcChannelTypeDBusTube *self,
GabbleTubeDBus *tube = GABBLE_TUBE_DBUS (self);
GError *error = NULL;
+ if (!gabble_tube_dbus_check_access_control (tube, access_control, &error))
+ {
+ dbus_g_method_return_error (context, error);
+ g_error_free (error);
+ return;
+ }
+
if (gabble_tube_dbus_accept (GABBLE_TUBE_IFACE (tube), &error))
{
gabble_svc_channel_type_dbus_tube_return_from_accept (context,
--
1.5.6.5
More information about the telepathy-commits
mailing list