Patch: fix dialback for pre-XMPP Jabber servers

I have a problem with one of the corporate servers, it is probably something pretty old. imtrends describes the server as ejabberd 2.1.0, but it actually might be something older. Looking at the fix I came up with it might have been related to issue OF-443.

All contacts from that server seem to be “disconnected”; I’ve seen this also with some other XMPP server so it’s not an Openfire-only problem.

Here’s sample of the dialback request received:

Otherserver: <?xml version='1.0'?><stream:stream      xmlns:stream='' xmlns='jabber:server'      xmlns:db='jabber:server:dialback' to='my-domain'>
Openfire: <stream:stream xmlns:db="jabber:server:dialback"      xmlns:stream="" xmlns="jabber:server"      from="my-domain" id="f79c645b" version="1.0">
Otherserver: <stream:error><invalid-namespace xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error>
Openfire: </stream:stream>

This patch seems to fix the issue:

Index: src/java/org/jivesoftware/openfire/session/
--- src/java/org/jivesoftware/openfire/session/     (wersja 12902)
+++ src/java/org/jivesoftware/openfire/session/     (kopia robocza)
@@ -122,7 +122,11 @@
             openingStream.append(" xmlns=\"jabber:server\"");
             openingStream.append(" from=\"").append(serverName).append("\"");
             openingStream.append(" id=\"").append(streamID).append("\"");
-            openingStream.append(" version=\"1.0\">");
+            if (serverVersion[0] >= 1) {
+                openingStream.append(" version=\"1.0\">");
+            } else {
+                openingStream.append(">");
+            }
             connection.deliverRawText(openingStream.toString());              if (serverVersion[0] >= 1) {

Interestingly, the other server seems to accept “version=1.0” in our dialback requests without any problem.

Updated OF-443 with a patch