[Telepathy-commits] [telepathy-gabble/master] ImFactory: reject requests containing unknown properties

Will Thompson will.thompson at collabora.co.uk
Tue Sep 9 03:58:34 PDT 2008


---
 src/im-factory.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/im-factory.c b/src/im-factory.c
index f8fd3c2..ab52e2b 100644
--- a/src/im-factory.c
+++ b/src/im-factory.c
@@ -482,6 +482,12 @@ gabble_im_factory_foreach_channel (TpChannelManager *manager,
 }
 
 
+static const gchar * const im_channel_fixed_properties[] = {
+    TP_IFACE_CHANNEL ".ChannelType",
+    TP_IFACE_CHANNEL ".TargetHandleType",
+    NULL
+};
+
 static const gchar * const im_channel_allowed_properties[] = {
     TP_IFACE_CHANNEL ".TargetHandle",
     NULL
@@ -499,12 +505,12 @@ gabble_im_factory_foreach_channel_class (TpChannelManager *manager,
 
   value = tp_g_value_slice_new (G_TYPE_STRING);
   g_value_set_static_string (value, TP_IFACE_CHANNEL_TYPE_TEXT);
-  g_hash_table_insert (table, TP_IFACE_CHANNEL ".ChannelType",
+  g_hash_table_insert (table, (gchar *) im_channel_fixed_properties[0],
       value);
 
   value = tp_g_value_slice_new (G_TYPE_UINT);
   g_value_set_uint (value, TP_HANDLE_TYPE_CONTACT);
-  g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType",
+  g_hash_table_insert (table, (gchar *) im_channel_fixed_properties[1],
       value);
 
   func (manager, table, im_channel_allowed_properties, user_data);
@@ -540,6 +546,11 @@ gabble_im_factory_requestotron (GabbleImFactory *self,
   if (!tp_handle_is_valid (contact_repo, handle, &error))
     goto error;
 
+  if (tp_channel_manager_asv_has_unknown_properties (request_properties,
+          im_channel_fixed_properties, im_channel_allowed_properties,
+          &error))
+    goto error;
+
   channel = g_hash_table_lookup (self->priv->channels,
       GUINT_TO_POINTER (handle));
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list