IQ packet without 'id' attribute causes connection drop
Description
Environment
is duplicated by
Activity
Martin Weusten November 21, 2008 at 3:43 AM
CenterIM Bug-Report
http://bugzilla.centerim.org/show_bug.cgi?id=119
Martin Weusten November 20, 2008 at 9:41 PM
Miranda Bug-Report
http://bugs.miranda-im.org/view.php?id=501
Martin Hradil November 19, 2008 at 9:56 PM
IMHO not kicking either side is the best solution usabiliti-wise if not standards-wise.
This patch seems to work for us:
— src/java/org/xmpp/packet/IQ.java 2008-11-05 16:16:16 +0000
+++ src/java/org/xmpp/packet/IQ.java 2008-11-16 00:35:37 +0000
@@ -67,6 +67,10 @@
*/
public IQ(Element element) {
super(element);
+ if (getID() == null) {
+ String id = String.valueOf(random.nextInt(1000) + "-" + sequence++);
+ setID(id);
+ }
}
/**
@@ -80,6 +84,10 @@
*/
public IQ(Element element, boolean skipValidation) {
super(element, skipValidation);
+ if (getID() == null) {
+ String id = String.valueOf(random.nextInt(1000) + "-" + sequence++);
+ setID(id);
+ }
}
/**
@@ -95,6 +103,10 @@
// Copy cached JIDs (for performance reasons)
this.toJID = iq.toJID;
this.fromJID = iq.fromJID;
+ if (getID() == null) {
+ String id = String.valueOf(random.nextInt(1000) + "-" + sequence++);
+ setID(id);
+ }
}
/**
Martin Weusten November 19, 2008 at 5:52 AM
Ok, gave it a quick test, looks good. However, I suggest a default value of true
instead of false
for the new system property xmpp.server.validation.enabled
Martin Weusten November 18, 2008 at 4:23 AM
If packets will still be able to get into the server then we need to fix the known NPE besides fixing StanzaHandler. However, we should know that other NPE could still happen since IQ packets may go to components that will have the same problem.
What about doing that same that the plugin does? (simply adding that ID attribute)
However, best way would be solving this issue on client side.
http://www.igniterealtime.org/community/message/179066