-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
OF-3222: Improve XEP-0359 stanza-id handling for one-on-one routing and archiving #3234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * Copyright (C) 2005-2008 Jive Software, 2016-2025 Ignite Realtime Foundation. All rights reserved. | ||
| * Copyright (C) 2005-2008 Jive Software, 2016-2026 Ignite Realtime Foundation. All rights reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
|
|
@@ -33,6 +33,7 @@ | |
| import org.jivesoftware.openfire.server.OutgoingSessionPromise; | ||
| import org.jivesoftware.openfire.server.RemoteServerManager; | ||
| import org.jivesoftware.openfire.session.*; | ||
| import org.jivesoftware.openfire.stanzaid.StanzaIDUtil; | ||
| import org.jivesoftware.util.JiveGlobals; | ||
| import org.jivesoftware.util.LocaleUtils; | ||
| import org.jivesoftware.util.TaskEngine; | ||
|
|
@@ -364,6 +365,11 @@ private boolean routeToLocalDomain(JID jid, Packet packet) | |
| } | ||
| else { | ||
| // RFC 6121 section 8.5.3. localpart@domainpart/resourcepart (Packet sent to a full JID of a user) | ||
| // Add stanza ID for one-on-one messages sent to full JIDs as per XEP-0359 | ||
| if (packet instanceof Message message) { | ||
| StanzaIDUtil.ensureUniqueAndStableStanzaID(message, jid.asBareJID()); | ||
| } | ||
|
Comment on lines
+368
to
+371
|
||
|
|
||
| ClientRoute clientRoute = getClientRouteForLocalUser(jid); | ||
| if (clientRoute != null) { | ||
| // RFC-6121 section 8.5.3.1. Resource Matches | ||
|
|
@@ -624,6 +630,10 @@ private boolean routeToRemoteDomain(JID jid, Packet packet) { | |
| * @return true if at least one target session was found | ||
| */ | ||
| private boolean routeToBareJID(JID recipientJID, Message packet) { | ||
| // Add stanza ID for one-on-one messages as per XEP-0359 | ||
| // The assigning entity for one-on-one messages is the receiving user's bare JID | ||
| StanzaIDUtil.ensureUniqueAndStableStanzaID(packet, recipientJID.asBareJID()); | ||
|
|
||
|
Comment on lines
632
to
+636
|
||
| List<ClientSession> sessions = new ArrayList<>(); | ||
| // Get existing AVAILABLE sessions of this user or AVAILABLE to the sender of the packet | ||
| for (JID address : getRoutes(recipientJID, packet.getFrom())) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition
!recipientJID.getDomain().endsWith("." + serverName)treats any subdomain of the local domain as a local component. That can incorrectly skip sender-owned stanza-id injection for legitimate remote domains that happen to be subdomains (e.g.user@chat.example.comwhenserverNameisexample.com). Instead of a string suffix check, use an explicit local-component test (e.g.XMPPServer.getInstance().matchesComponent(recipientJID)and/orroutingTable.hasComponentRoute(recipientJID)) to exclude only domains that are actually hosted components.