IQ packet without 'id' attribute causes connection drop

Environment

None

is duplicated by

Activity

Show:

Martin Weusten 
November 21, 2008 at 3:43 AM

Martin Weusten 
November 20, 2008 at 9:41 PM

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.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created September 11, 2008 at 12:37 AM
Updated November 21, 2008 at 3:43 AM
Resolved November 19, 2008 at 2:45 AM