25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +01:00

Don't send error stanza as reply to error stanza (EJAB-930)

This commit is contained in:
Badlop 2010-04-20 20:31:17 +02:00
parent 6cdfec1284
commit 1d7daab4e8
3 changed files with 13 additions and 2 deletions

View File

@ -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).

View File

@ -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}.

View File

@ -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.