AnsweredAssumed Answered

Smack IQ not correctly implemented with null to field

Question asked by Harshit Bangar on Oct 24, 2015
Latest reply on Oct 29, 2015 by Flow

Hi Flow,

Not sure if this is an issue but smack's iq with no to field or bare jid it doesn't expect a from filter . Ejabberd when given an iq with no to returns a response with barejid: jabberd:iq:roster. 

Smack's fromfilter - e4754/smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.j ava- The address to filter for. If null is given, the stanza(/packet) must not have a from address.

RFC6120 -
When the server generates a stanza from the server for delivery to the client on behalf of the account of the connected client (e.g., in the context of data storage services provided by the
server on behalf of the client), the stanza MUST either (a) not include a 'from' attribute or (b) include a 'from' attribute whose value is the account's bare JID (localpart@domainpart).



<iq id='5t07M-8' type='get'><query xmlns='jabber:iq:roster'></query></iq>


<iq from='' to='' id='5t07M-8' type='result'><query xmlns='jabber:iq:roster'><item ask='subscribe' subscription='none' jid=''/><item subscription='both' jid=''/><item subscription='both' name='f7ed67f4-8f97-4df5-82b2-09936d71fd8a' jid=''/><item subscription='both' jid=''/></query></iq><r xmlns='urn:xmpp:sm:3'/>


In IQReplyFilter

    fromFilter = new OrFilter();
    if (to == null) {
    else if (to.equals(local.asBareJid())) {


to is null and therefore fromfilter first condition is null. In abstrctjid it's giving null pointer since from field is present in iq result. It looks wrong to me.