1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

Add and use IQReplyFilter (SMACK-533)

In the absence of checks on the from address, it is possible for other
clients to fake an answer to an IQ request.

This commit adds an IQReplyFilter, which drops all packets which are not
a valid reply to an IQ request. In particular, it checks for packet id,
from address and packet type.

Most(?) places waiting for a reply to an IQ request are converted to use
the IQReplyFilter.

For a discussion of the issues, see the thread "Spoofing of iq ids and
misbehaving servers" from 2014-01 on the jdev@jabber.org mailing list
and following discussion in February and March.
This commit is contained in:
Lars Noschinski 2014-02-23 21:08:35 +01:00 committed by Florian Schmaus
parent 980047c4e1
commit 6c7296a37b
13 changed files with 520 additions and 134 deletions

View file

@ -25,7 +25,7 @@ import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.PacketIDFilter;
import org.jivesoftware.smack.filter.IQReplyFilter;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
@ -130,7 +130,7 @@ public class CarbonManager {
}
connection.removePacketListener(this);
}
}, new PacketIDFilter(setIQ.getPacketID()));
}, new IQReplyFilter(setIQ, connection));
connection.sendPacket(setIQ);
}