Commit 6d64705c authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Fixed routing of IQ packets to remote servers.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8951 b35dd754-fafc-0310-a699-88a17e54d16e
parent d56a194f
...@@ -203,13 +203,27 @@ public class IQRouter extends BasicModule { ...@@ -203,13 +203,27 @@ public class IQRouter extends BasicModule {
/** /**
* A JID is considered local if: * A JID is considered local if:
* 1) is null or * 1) is null or
* 2) has no domain or domain is empty or * 2) has no domain or domain is empty
* 3) has no resource or resource is empty * or
* if it's not a full JID and it was sent to the server itself.
*
* @param recipientJID address to check.
* @return true if the specified address belongs to the local server.
*/ */
private boolean isLocalServer(JID recipientJID) { private boolean isLocalServer(JID recipientJID) {
return recipientJID == null || recipientJID.getDomain() == null // Check if no address was specified in the IQ packet
|| "".equals(recipientJID.getDomain()) || recipientJID.getResource() == null boolean implicitServer =
|| "".equals(recipientJID.getResource()); recipientJID == null || recipientJID.getDomain() == null || "".equals(recipientJID.getDomain());
if (!implicitServer) {
// We found an address. Now check if it's a bare or full JID
if (recipientJID.getNode() == null || recipientJID.getResource() == null) {
// Address is a bare JID so check if it was sent to the server itself
return serverName.equals(recipientJID.getDomain());
}
// Address is a full JID. IQ packets sent to full JIDs are not handle by the server
return false;
}
return true;
} }
private void handle(IQ packet) { private void handle(IQ packet) {
...@@ -297,7 +311,7 @@ public class IQRouter extends BasicModule { ...@@ -297,7 +311,7 @@ public class IQRouter extends BasicModule {
} }
} }
else { else {
// JID is of the form <node@domain/resource> // JID is of the form <node@domain/resource> or belongs to a remote server
routingTable.routePacket(recipientJID, packet, false); routingTable.routePacket(recipientJID, packet, false);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment