about summary refs log tree commit diff stats
path: root/tests/unittests/test_common.c
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2019-10-29 22:48:14 +0100
committeraszlig <aszlig@nix.build>2019-10-29 23:10:07 +0100
commitb1e960cfae6352f271bda14d50b7ed4b3ea57d80 (patch)
tree85eb7414470921fa517e90d234f8bccd1c967e0f /tests/unittests/test_common.c
parent900426025e49224875709faccd619d7fd5944496 (diff)
downloadprofani-tty-b1e960cfae6352f271bda14d50b7ed4b3ea57d80.tar.gz
omemo: Check stanza names when iterating nodes
Some clients (eg. PSI) are sending the stanzas delimited by whitespace
text nodes, which will fail while looping through the <prekeys/>
children and also print weird errors when iterating through the <list/>
of devices.

When debugging this, I was looking at the XML of Gajim and PSI and first
was somehow confused why Profanity printed "OMEMO: received device
without ID" while the XML looked identical (minus the actual IDs and the
JIDs of course).

However, Gajim was sending the XML without whitespace nodes in between
and PSI did not, so for example the following (with the relevant
whitespace nodes marked with X):

  <message type="headline" to="..." from="...">
    <event xmlns="http://jabber.org/protocol/pubsub#event">
      <items type="headline" node="eu.siacs.conversations.axolotl.devicelist">
        <item id="...">
          <list xmlns="eu.siacs.conversations.axolotl">
          X <device id="..."/>
          X <device id="..."/> X
          </list>
        </item>
      </items>
    </event>
    <delay xmlns="urn:xmpp:delay" stamp="..." from="..."/>
  </message>

... would result in three times the "OMEMO: received device without ID"
error, because we actually have three XML text nodes here that obviously
don't have an "id" attribute.

Now since the <list/> children above aren't really a problem and only
annoying, text nodes in the <prekeys/> stanza actually cause
omemo_start_device_session_handle_bundle to return failure.

I've fixed this by explicitly matching the stanza names we are
interested in, skipping everything else.

Signed-off-by: aszlig <aszlig@nix.build>
Reported-by: @devhell
Diffstat (limited to 'tests/unittests/test_common.c')
0 files changed, 0 insertions, 0 deletions