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
0650e0db
Commit
0650e0db
authored
Sep 24, 2017
by
Guus der Kinderen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OF-1379: Packet interceptors should be triggered for S2S failure responses.
parent
c0ad7f92
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
12 deletions
+35
-12
InterceptorManager.java
...jivesoftware/openfire/interceptor/InterceptorManager.java
+2
-2
OutgoingSessionPromise.java
.../jivesoftware/openfire/server/OutgoingSessionPromise.java
+33
-10
No files found.
src/java/org/jivesoftware/openfire/interceptor/InterceptorManager.java
View file @
0650e0db
...
...
@@ -253,7 +253,7 @@ public class InterceptorManager {
// Do nothing
return
;
}
String
username
=
session
.
getAddress
().
getNode
()
;
String
username
=
session
!=
null
?
session
.
getAddress
().
getNode
()
:
null
;
if
(
username
!=
null
&&
server
.
isLocal
(
session
.
getAddress
()))
{
Collection
<
PacketInterceptor
>
userInterceptors
=
usersInterceptors
.
get
(
username
);
if
(
userInterceptors
!=
null
&&
!
userInterceptors
.
isEmpty
())
{
...
...
@@ -277,4 +277,4 @@ public class InterceptorManager {
}
}
}
}
\ No newline at end of file
}
src/java/org/jivesoftware/openfire/server/OutgoingSessionPromise.java
View file @
0650e0db
...
...
@@ -16,17 +16,18 @@
package
org
.
jivesoftware
.
openfire
.
server
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Queue
;
import
java.util.*
;
import
java.util.concurrent.*
;
import
java.util.concurrent.locks.Lock
;
import
org.jivesoftware.openfire.RoutableChannelHandler
;
import
org.jivesoftware.openfire.RoutingTable
;
import
org.jivesoftware.openfire.SessionManager
;
import
org.jivesoftware.openfire.XMPPServer
;
import
org.jivesoftware.openfire.interceptor.InterceptorManager
;
import
org.jivesoftware.openfire.interceptor.PacketInterceptor
;
import
org.jivesoftware.openfire.interceptor.PacketRejectedException
;
import
org.jivesoftware.openfire.session.ClientSession
;
import
org.jivesoftware.openfire.session.ConnectionSettings
;
import
org.jivesoftware.openfire.session.LocalOutgoingServerSession
;
import
org.jivesoftware.openfire.spi.RoutingTableImpl
;
...
...
@@ -279,10 +280,12 @@ public class OutgoingSessionPromise implements RoutableChannelHandler {
!
server
.
isLocal
(
to
)
&&
!
XMPPServer
.
getInstance
().
matchesComponent
(
to
))
{
// Do nothing since the sender and receiver of the packet that failed to reach a remote
// server are not local users. This prevents endless loops if the FROM or TO address
// are non-existen addresses
// are non-existen
t
addresses
return
;
}
final
Set
<
Packet
>
replies
=
new
HashSet
<>();
// TODO Send correct error condition: timeout or not_found depending on the real error
try
{
if
(
packet
instanceof
IQ
)
{
...
...
@@ -292,7 +295,8 @@ public class OutgoingSessionPromise implements RoutableChannelHandler {
reply
.
setFrom
(
to
);
reply
.
setChildElement
(((
IQ
)
packet
).
getChildElement
().
createCopy
());
reply
.
setError
(
PacketError
.
Condition
.
remote_server_not_found
);
routingTable
.
routePacket
(
reply
.
getTo
(),
reply
,
true
);
replies
.
add
(
reply
);
}
else
if
(
packet
instanceof
Presence
)
{
// workaround for OF-23. "undo" the 'setFrom' to a bare JID
...
...
@@ -310,8 +314,9 @@ public class OutgoingSessionPromise implements RoutableChannelHandler {
reply
.
setTo
(
route
);
reply
.
setFrom
(
to
);
reply
.
setError
(
PacketError
.
Condition
.
remote_server_not_found
);
routingTable
.
routePacket
(
reply
.
getTo
(),
reply
,
true
);
}
replies
.
add
(
reply
);
}
}
else
if
(
packet
instanceof
Message
)
{
Message
reply
=
new
Message
();
...
...
@@ -321,7 +326,25 @@ public class OutgoingSessionPromise implements RoutableChannelHandler {
reply
.
setType
(((
Message
)
packet
).
getType
());
reply
.
setThread
(((
Message
)
packet
).
getThread
());
reply
.
setError
(
PacketError
.
Condition
.
remote_server_not_found
);
routingTable
.
routePacket
(
reply
.
getTo
(),
reply
,
true
);
replies
.
add
(
reply
);
}
// Send all replies.
final
SessionManager
sessionManager
=
SessionManager
.
getInstance
();
for
(
final
Packet
reply
:
replies
)
{
try
{
final
ClientSession
session
=
sessionManager
.
getSession
(
reply
.
getTo
()
);
InterceptorManager
.
getInstance
().
invokeInterceptors
(
reply
,
session
,
false
,
false
);
routingTable
.
routePacket
(
reply
.
getTo
(),
reply
,
true
);
InterceptorManager
.
getInstance
().
invokeInterceptors
(
reply
,
session
,
false
,
true
);
}
catch
(
PacketRejectedException
ex
)
{
Log
.
debug
(
"Reply got rejected by an interceptor: "
,
reply
,
ex
);
}
}
}
catch
(
Exception
e
)
{
...
...
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