Roster push update problem

Issue #63 closed
Ebbe George Haabendal Brandstrup created an issue

Hi,

I'm having trouble getting roster update events pushed to my babbler xmpp-client.

When debugging the RosterManager class, the IQ I receive contains a resource identifier in the "from" jid, but the code which handles the Roster IQ "SET" events only performs roster updates if the "from" jid matches a bare jid (RosterManager.java:185) - or the "from" jid is null:

if (iq.getFrom() == null || iq.getFrom().equals(xmppSession.getConnectedResource().asBareJid())) {

This is the XML I get in the IQ from my XMPP server:

<iq from="integration-test_user_a@domain/resource" id="push" to="integration-test_user_a@domain/resource" type="set">
    <query xmlns="jabber:iq:roster">
        <item jid="integration-test_user_b@domain" name="integration-test_user_b" subscription="from">
            <group>Contacts</group>
        </item>
    </query>
</iq>

It is somehow expected that I prevent my XMPP server to only send a bare jid in the "from" attribute or is this a bug?

Comments (6)

  1. Christian Schudt repo owner

    Actually this is a bug in your server then and I'd rather not want to "fix" it in my library and then violate the spec.

    Which server do you use?

    The if statement conforms to the two rules described here: http://xmpp.org/rfcs/rfc6121.html#roster-syntax-actions-push, one of them says, roster pushes MUST be ignored, if it's not from the bare JID.

    A receiving client MUST ignore the stanza unless it has no 'from' attribute (i.e., implicitly from the bare JID of the user's account) or it has a 'from' attribute whose value matches the user's bare JID user@domainpart.

  2. Ebbe George Haabendal Brandstrup reporter

    Hi Christian,

    Thanks a lot for the quick answer - and for a great library!

    We are using ejabberd, and indeed it turns out that this is a bug on their end, which was resolved in October. Sorry for taking your time on this and thanks a lot for pointing me in the right direction!

  3. Christian Schudt repo owner

    Hi, you're welcome. The reason why roster pushes should only come from bare JIDs is, that otherwise everybody could "inject" contacts into your roster (due to IQ routing semantics). Bare JIDs always come from the server, so the client can be sure, that the IQ was generated by the server.

  4. Log in to comment