Commit 637cc817 authored by Dele Olajide's avatar Dele Olajide

Section 8.5.1 of RFC 6121 - No such user

This cannot be enforced strictly for openfire IQ handlers to process packets for custom namespaces. I am modifying the original fix to exclude IQ handlers and also check for anonymous users.
parent bcacd508
...@@ -327,15 +327,6 @@ public class IQRouter extends BasicModule { ...@@ -327,15 +327,6 @@ public class IQRouter extends BasicModule {
return; return;
} }
// RFC 6121 8.5.1. No Such User http://xmpp.org/rfcs/rfc6121.html#rules-localpart-nosuchuser
// If the 'to' address specifies a bare JID <localpart@domainpart> or full JID <localpart@domainpart/resourcepart> where the domainpart of the JID matches a configured domain that is serviced by the server itself, the server MUST proceed as follows.
// If the user account identified by the 'to' attribute does not exist, how the stanza is processed depends on the stanza type.
if (recipientJID != null && recipientJID.getNode() != null && serverName.equals(recipientJID.getDomain()) && !userManager.isRegisteredUser(recipientJID.getNode()) && (IQ.Type.set == packet.getType() || IQ.Type.get == packet.getType())) {
// For an IQ stanza, the server MUST return a <service-unavailable/> stanza error to the sender.
sendErrorPacket(packet, PacketError.Condition.service_unavailable);
return;
}
if (isLocalServer(recipientJID)) { if (isLocalServer(recipientJID)) {
// Let the server handle the Packet // Let the server handle the Packet
Element childElement = packet.getChildElement(); Element childElement = packet.getChildElement();
...@@ -386,6 +377,16 @@ public class IQRouter extends BasicModule { ...@@ -386,6 +377,16 @@ public class IQRouter extends BasicModule {
} }
} }
else { else {
// RFC 6121 8.5.1. No Such User http://xmpp.org/rfcs/rfc6121.html#rules-localpart-nosuchuser
// If the 'to' address specifies a bare JID <localpart@domainpart> or full JID <localpart@domainpart/resourcepart> where the domainpart of the JID matches a configured domain that is serviced by the server itself, the server MUST proceed as follows.
// If the user account identified by the 'to' attribute does not exist, how the stanza is processed depends on the stanza type.
if (recipientJID != null && recipientJID.getNode() != null && serverName.equals(recipientJID.getDomain()) && !userManager.isRegisteredUser(recipientJID.getNode()) && sessionManager.getSession(recipientJID) == null && (IQ.Type.set == packet.getType() || IQ.Type.get == packet.getType())) {
// For an IQ stanza, the server MUST return a <service-unavailable/> stanza error to the sender.
sendErrorPacket(packet, PacketError.Condition.service_unavailable);
return;
}
ClientSession session = sessionManager.getSession(packet.getFrom()); ClientSession session = sessionManager.getSession(packet.getFrom());
boolean isAcceptable = true; boolean isAcceptable = true;
if (session instanceof LocalClientSession) { if (session instanceof LocalClientSession) {
......
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