mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Don't send error stanza as reply to error stanza (EJAB-930)
This commit is contained in:
parent
2d375e0429
commit
2ff291899d
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
%% API
|
%% API
|
||||||
-export([route/3,
|
-export([route/3,
|
||||||
|
route_error/4,
|
||||||
register_route/1,
|
register_route/1,
|
||||||
register_route/2,
|
register_route/2,
|
||||||
register_routes/1,
|
register_routes/1,
|
||||||
@ -72,6 +73,17 @@ route(From, To, Packet) ->
|
|||||||
ok
|
ok
|
||||||
end.
|
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) ->
|
||||||
|
{xmlelement, _Name, Attrs, _Els} = OrigPacket,
|
||||||
|
case "error" == xml:get_attr_s("type", Attrs) of
|
||||||
|
false ->
|
||||||
|
route(From, To, ErrPacket);
|
||||||
|
true ->
|
||||||
|
ok
|
||||||
|
end.
|
||||||
|
|
||||||
register_route(Domain) ->
|
register_route(Domain) ->
|
||||||
register_route(Domain, undefined).
|
register_route(Domain, undefined).
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ handle_info({route, From, To, Packet}, StateName, StateData) ->
|
|||||||
send_text(StateData, Text);
|
send_text(StateData, Text);
|
||||||
deny ->
|
deny ->
|
||||||
Err = jlib:make_error_reply(Packet, ?ERR_NOT_ALLOWED),
|
Err = jlib:make_error_reply(Packet, ?ERR_NOT_ALLOWED),
|
||||||
ejabberd_router:route(To, From, Err)
|
ejabberd_router:route_error(To, From, Err, Packet)
|
||||||
end,
|
end,
|
||||||
{next_state, StateName, StateData}.
|
{next_state, StateName, StateData}.
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ do_route(Host, ServerHost, Access, HistorySize, RoomShaper,
|
|||||||
ErrText = "Access denied by service policy",
|
ErrText = "Access denied by service policy",
|
||||||
Err = jlib:make_error_reply(Packet,
|
Err = jlib:make_error_reply(Packet,
|
||||||
?ERRT_FORBIDDEN(Lang, ErrText)),
|
?ERRT_FORBIDDEN(Lang, ErrText)),
|
||||||
ejabberd_router:route(To, From, Err)
|
ejabberd_router:route_error(To, From, Err, Packet)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user