mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-30 16:36:29 +01:00
Don't send error stanza as reply to error stanza (EJAB-930)
This commit is contained in:
parent
6cdfec1284
commit
1d7daab4e8
@ -31,6 +31,7 @@
|
||||
|
||||
%% API
|
||||
-export([route/3,
|
||||
route_error/4,
|
||||
register_route/1,
|
||||
register_route/2,
|
||||
register_routes/1,
|
||||
@ -83,6 +84,16 @@ route(From, To, Packet) ->
|
||||
ok
|
||||
end.
|
||||
|
||||
%% Route the error packet only if the originating packet is not an error itself.
|
||||
%% RFC3920 9.3.1
|
||||
route_error(From, To, ErrPacket, OrigPacket) ->
|
||||
case exmpp_stanza:is_stanza_error(OrigPacket) of
|
||||
false ->
|
||||
route(From, To, ErrPacket);
|
||||
true ->
|
||||
ok
|
||||
end.
|
||||
|
||||
register_route(Domain) ->
|
||||
register_route(Domain, undefined).
|
||||
|
||||
|
@ -347,7 +347,7 @@ handle_info({route, From, To, Packet}, StateName, StateData) ->
|
||||
send_element(StateData, El2);
|
||||
deny ->
|
||||
Err = exmpp_stanza:reply_with_error(Packet, 'not-allowed'),
|
||||
ejabberd_router:route(To, From, Err)
|
||||
ejabberd_router:route_error(To, From, Err, Packet)
|
||||
end,
|
||||
{next_state, StateName, StateData}.
|
||||
|
||||
|
@ -338,7 +338,7 @@ do_route(Host, ServerHost, Access, HistorySize, RoomShaper,
|
||||
Err = exmpp_iq:error(Packet,exmpp_stanza:error(Packet#xmlel.ns,
|
||||
'forbidden',
|
||||
{Lang,ErrText})),
|
||||
ejabberd_router:route(To, From, Err)
|
||||
ejabberd_router:route_error(To, From, Err, Packet)
|
||||
end.
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user