diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2011-10-28 18:34:25 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-10-31 09:37:52 +0000 |
commit | 9cf653e93ba9beb8ff2df73627cd2b1f5bedf6bc (patch) | |
tree | cf0a272dcdd2adc5720b348d4d67d14f348c8b8c | |
parent | c3b6d2101aa5257a6f1ec927f3b0f3b3911cd2a6 (diff) |
roster: ignore multiple replies to roster query.
The XMPP server running on vk.com is buggy, and replies to our roster
query twice. Gabble just blindly assumed that any <iq type='result'>
with a roster in it was the singular reply to our singular query. This
is a pretty reasonable assumption but this buggy server violates it, and
Gabble calls tp_base_contact_list_set_list_received() more than once,
which triggers a critical in that function.
A more invasive fix would use wocky_porter_send_iq_async() rather than
scraping all the roster IQs out of everything using the LM API, but I
wanted to quickly fix a bug on a Friday afternoon.
Fixes: <https://bugs.freedesktop.org/show_bug.cgi?id=42186>
Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r-- | src/roster.c | 10 | ||||
-rw-r--r-- | tests/twisted/roster/test-roster.py | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/roster.c b/src/roster.c index 6612f4a83..5656662a5 100644 --- a/src/roster.c +++ b/src/roster.c @@ -1359,6 +1359,16 @@ got_roster_iq (GabbleRoster *roster, return FALSE; } + if (sub_type == WOCKY_STANZA_SUB_TYPE_RESULT && priv->received) + { + /* <https://bugs.freedesktop.org/show_bug.cgi?id=42186>: some super-buggy + * XMPP server running on vk.com sends its reply to our roster query twice. + */ + DEBUG ("The server sent replied to our roster query more than once! " + "Ignoring this reply"); + return FALSE; + } + process_roster (roster, query_node); if (sub_type == WOCKY_STANZA_SUB_TYPE_RESULT) diff --git a/tests/twisted/roster/test-roster.py b/tests/twisted/roster/test-roster.py index bd892568a..04fee09d8 100644 --- a/tests/twisted/roster/test-roster.py +++ b/tests/twisted/roster/test-roster.py @@ -32,6 +32,11 @@ def test(q, bus, conn, stream): stream.send(event.stanza) + # Regression test for <https://bugs.freedesktop.org/show_bug.cgi?id=42186>: + # some super-buggy XMPP server running on vk.com sends its reply to our + # roster query twice. This used to crash Gabble. + stream.send(event.stanza) + # slight implementation detail: TpBaseContactList emits ContactsChanged # before it announces its channels s = q.expect('dbus-signal', signal='ContactsChanged', |