[telepathy-gabble/master] Don't accept an open ibb iq if we didn't accept the bytestream yet

Sjoerd Simons sjoerd.simons at collabora.co.uk
Fri Dec 18 11:21:37 PST 2009


---
 src/bytestream-factory.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/bytestream-factory.c b/src/bytestream-factory.c
index acdad38..55d305d 100644
--- a/src/bytestream-factory.c
+++ b/src/bytestream-factory.c
@@ -1297,6 +1297,7 @@ handle_ibb_open_iq (GabbleBytestreamFactory *self,
   LmMessageNode *open_node;
   ConstBytestreamIdentifier bsid = { NULL, NULL };
   const gchar *tmp;
+  guint state;
 
   if (lm_message_get_sub_type (msg) != LM_MESSAGE_SUB_TYPE_SET)
     return FALSE;
@@ -1334,6 +1335,17 @@ handle_ibb_open_iq (GabbleBytestreamFactory *self,
       return TRUE;
     }
 
+  g_object_get (bytestream, "state", &state, NULL);
+
+  if (state != GABBLE_BYTESTREAM_STATE_ACCEPTED)
+    {
+      /* We don't accept streams not previously accepted using SI */
+      DEBUG ("unaccepted stream: <%s> from <%s>", bsid.stream, bsid.jid);
+      _gabble_connection_send_iq_error (priv->conn, msg,
+          XMPP_ERROR_BAD_REQUEST, NULL);
+      return TRUE;
+    }
+
   tmp = lm_message_node_get_attribute (open_node, "block-size");
   if (tmp != NULL)
     {
-- 
1.5.6.5




More information about the telepathy-commits mailing list