[Telepathy-commits] [telepathy-gabble/master] Reject contact list requests containing unknown properties

Will Thompson will.thompson at collabora.co.uk
Tue Sep 16 04:18:41 PDT 2008


---
 src/roster.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/src/roster.c b/src/roster.c
index 60f6fb5..1af224f 100644
--- a/src/roster.c
+++ b/src/roster.c
@@ -2467,6 +2467,14 @@ gabble_roster_handle_remove_from_group (GabbleRoster *roster,
 }
 
 
+static const gchar * const list_channel_fixed_properties[] = {
+    TP_IFACE_CHANNEL ".ChannelType",
+    TP_IFACE_CHANNEL ".TargetHandleType",
+    NULL
+};
+static const gchar * const *group_channel_fixed_properties =
+    list_channel_fixed_properties;
+
 static const gchar * const list_channel_allowed_properties[] = {
     TP_IFACE_CHANNEL ".TargetHandle",
     NULL
@@ -2521,6 +2529,8 @@ gabble_roster_request (GabbleRoster *self,
   TpHandle handle;
   GError *error = NULL;
   TpHandleRepoIface *handle_repo;
+  const gchar * const *fixed;
+  const gchar * const *allowed;
 
   if (tp_strdiff (tp_asv_get_string (request_properties,
           TP_IFACE_CHANNEL ".ChannelType"),
@@ -2543,6 +2553,21 @@ gabble_roster_request (GabbleRoster *self,
   if (!tp_handle_is_valid (handle_repo, handle, &error))
     goto error;
 
+  if (handle_type == TP_HANDLE_TYPE_LIST)
+    {
+      fixed = list_channel_fixed_properties;
+      allowed = list_channel_allowed_properties;
+    }
+  else /* handle_type == TP_HANDLE_TYPE_GROUP */
+    {
+      fixed = group_channel_fixed_properties;
+      allowed = group_channel_allowed_properties;
+    }
+
+  if (tp_channel_manager_asv_has_unknown_properties (request_properties,
+          fixed, allowed, &error))
+    goto error;
+
   /* disallow "deny" channels if we don't have google:roster support */
   if (handle_type == TP_HANDLE_TYPE_LIST &&
       handle == GABBLE_LIST_HANDLE_DENY &&
-- 
1.5.6.5




More information about the Telepathy-commits mailing list