Bug Report & Patch: Openfire cannot communicate with IM servers in subdomains of xmpp.domain

Release series 3.4 appears to have introduced a bug resulting in the inability to communicate with servers serving a subdomain of the xmpp.domain.

For instance, darian@example.com cannot communicate with otheruser@branchoffice.example.com. This is due to the fact that Openfire assumes that a JID containing the xmpp.domain is a locally hosted component if the JID’s domain is not equal to the xmpp.domain. This bug was discovered in Openfire 3.4.4 and still exists in the recently released Openfire 3.5.0. I’ve attached a patch.

Thanks,

Darian

Could someone from Jive please acknowledge this issue? It’s been out there for a while. I know you all are busy with recent changes to Enterprise and the other issues with 3.5.0, but I’m hoping someone could acknowledge the existence of this issue. Thanks.

Howdy! I think we must have missed this report before. (so much comes through the forums it’s hard to keep up) Thanks for bumping this! JM-1203 was created a while ago for this issue. I’m going to test it for 3.5.1 right now and aim to get it in there. Thanks for the patch and great find!

Hello,

it seems this bug is still around/reappeared in version 3.9.1. Again it is not possible to connect to a server in a subdomain of the xmpp.domain. The patch is quite similar to the old one from 2006. I have applied a patch for version 3.9.1 below.

Kind Regrads,

Jürgen

— ./src/java/org/jivesoftware/openfire/spi/RoutingTableImpl.java~ 2014-02-06 15:39:46.000000000 +0100
+++ ./src/java/org/jivesoftware/openfire/spi/RoutingTableImpl.java 2014-03-17 11:33:56.198208000 +0100
@@ -236,6 +236,10 @@
else if (jid.getDomain().contains(serverName)) {
// Packet sent to component hosted in this server
routed = routeToComponent(jid, packet, routed);

  •        if ( !routed ) {
    
  •         // most likely not a component but a subdomain server
    
  •         routed = routeToRemoteDomain(jid, packet, routed);
    
  •        }
       }
       else {
           // Packet sent to remote server

Looks reasonable to me, OF-757

Can somebody evaluate the differece between Darian Anthony Patrick’s patch and JuWo’s patch?

Which one shall be applied?

The first one asks for hasComponentRoute(jid)

while the latter just tries to route to the component and if it fails it routes to remote domain.

@JuWo: does the first patch also solve your problem?

I have double checked the original patch. After addepting it to the current code it works as well. So maybe this is even the better one as it is easier to read and more straight forward.

— ./src/java/org/jivesoftware/openfire/spi/RoutingTableImpl.java~ 2014-02-06 15:39:46.000000000 +0100
+++ ./src/java/org/jivesoftware/openfire/spi/RoutingTableImpl.java 2014-03-20 11:05:24.817190000 +0100
@@ -233,7 +233,7 @@
// Packet sent to our domain.
routed = routeToLocalDomain(jid, packet, fromServer);
}

  •    else if (jid.getDomain().contains(serverName)) {
    
  •    else if (jid.getDomain().contains(serverName) && hasComponentRoute(jid)) {
           // Packet sent to component hosted in this server
           routed = routeToComponent(jid, packet, routed);
       }

Ok, nothing big here…

Any objection or concerns, to replace “contains” with “endsWith” ? It seems to be more accurat.