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
78e84947
Commit
78e84947
authored
Nov 30, 2017
by
Greg Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow remotely connected servers to subscribe to local pubsub nodes
parent
d44eb157
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 @
78e84947
...
@@ -21,6 +21,7 @@ import org.dom4j.Element;
...
@@ -21,6 +21,7 @@ import org.dom4j.Element;
import
org.dom4j.QName
;
import
org.dom4j.QName
;
import
org.jivesoftware.openfire.PacketRouter
;
import
org.jivesoftware.openfire.PacketRouter
;
import
org.jivesoftware.openfire.RoutingTable
;
import
org.jivesoftware.openfire.RoutingTable
;
import
org.jivesoftware.openfire.SessionManager
;
import
org.jivesoftware.openfire.XMPPServer
;
import
org.jivesoftware.openfire.XMPPServer
;
import
org.jivesoftware.openfire.XMPPServerListener
;
import
org.jivesoftware.openfire.XMPPServerListener
;
import
org.jivesoftware.openfire.component.InternalComponentManager
;
import
org.jivesoftware.openfire.component.InternalComponentManager
;
...
@@ -572,7 +573,7 @@ public class PubSubEngine {
...
@@ -572,7 +573,7 @@ public class PubSubEngine {
private
void
subscribeNodeAsync
(
final
IQ
iq
,
final
JID
subscriberJID
,
final
Node
node
,
final
JID
owner
,
final
PubSubService
service
,
final
JID
from
,
final
Element
childElement
,
final
AccessModel
accessModel
)
{
private
void
subscribeNodeAsync
(
final
IQ
iq
,
final
JID
subscriberJID
,
final
Node
node
,
final
JID
owner
,
final
PubSubService
service
,
final
JID
from
,
final
Element
childElement
,
final
AccessModel
accessModel
)
{
// Check if the subscriber is an anonymous user
// 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
// Anonymous users cannot subscribe to the node. Return forbidden error
sendErrorPacket
(
iq
,
PacketError
.
Condition
.
forbidden
,
null
);
sendErrorPacket
(
iq
,
PacketError
.
Condition
.
forbidden
,
null
);
return
;
return
;
...
@@ -1934,4 +1935,25 @@ public class PubSubEngine {
...
@@ -1934,4 +1935,25 @@ public class PubSubEngine {
}
}
return
false
;
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