Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
c3727084
Commit
c3727084
authored
Nov 30, 2017
by
Greg Thomas
Committed by
akrherz
Feb 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow remotely connected servers to subscribe to local pubsub nodes
parent
8b249896
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
PubSubEngine.java
src/java/org/jivesoftware/openfire/pubsub/PubSubEngine.java
+23
-1
No files found.
src/java/org/jivesoftware/openfire/pubsub/PubSubEngine.java
View file @
c3727084
...
...
@@ -21,6 +21,7 @@ import org.dom4j.Element;
import
org.dom4j.QName
;
import
org.jivesoftware.openfire.PacketRouter
;
import
org.jivesoftware.openfire.RoutingTable
;
import
org.jivesoftware.openfire.SessionManager
;
import
org.jivesoftware.openfire.XMPPServer
;
import
org.jivesoftware.openfire.XMPPServerListener
;
import
org.jivesoftware.openfire.component.InternalComponentManager
;
...
...
@@ -542,7 +543,7 @@ public class PubSubEngine {
return
;
}
// Check if the subscriber is an anonymous user
if
(!
isComponent
(
subscriberJID
)
&&
!
UserManager
.
getInstance
().
isRegisteredUser
(
subscriberJID
))
{
if
(!
isComponent
(
subscriberJID
)
&&
!
isRemoteServer
(
subscriberJID
)
&&
!
UserManager
.
getInstance
().
isRegisteredUser
(
subscriberJID
))
{
// Anonymous users cannot subscribe to the node. Return forbidden error
sendErrorPacket
(
iq
,
PacketError
.
Condition
.
forbidden
,
null
);
return
;
...
...
@@ -1902,4 +1903,25 @@ public class PubSubEngine {
}
return
false
;
}
/**
* Checks to see if the supplied JID is that of a connected remote server
* @param jid the JID representing the remote server
* @return true if the supplied JID is a connected server session
*/
private
boolean
isRemoteServer
(
final
JID
jid
)
{
final
String
jidString
=
jid
.
toString
();
final
SessionManager
sessionManager
=
SessionManager
.
getInstance
();
for
(
final
String
incomingServer
:
sessionManager
.
getIncomingServers
())
{
if
(
incomingServer
.
equals
(
jidString
))
{
return
true
;
}
}
for
(
final
String
outgoingServer
:
sessionManager
.
getOutgoingServers
())
{
if
(
outgoingServer
.
equals
(
jidString
))
{
return
true
;
}
}
return
false
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment