25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Retract from previous commit the code that checked the connection is attempted to a known served component (EJAB-717)

SVN Revision: 1517
This commit is contained in:
Badlop 2008-08-09 20:09:37 +00:00
parent 62f22e8976
commit 1d6570cdec
2 changed files with 10 additions and 22 deletions

View File

@ -1,9 +1,8 @@
2008-08-09 Badlop <badlop@process-one.net> 2008-08-09 Badlop <badlop@process-one.net>
* src/ejabberd_service.erl: Fix XEP-0114 compliance: define xmlns * src/ejabberd_service.erl: Fix XEP-0114 compliance: define xmlns
in header of error response; check the connection is attempted to in header of error response; include in response the JID of served
a served component; include in response the JID of served component not server (thanks to Sergei Golovan)(EJAB-717)
component not server (thanks to Sergei Golovan)
2008-08-04 Jerome Sautret <jerome.sautret@process-one.net> 2008-08-04 Jerome Sautret <jerome.sautret@process-one.net>

View File

@ -79,13 +79,6 @@
"</stream:stream>" "</stream:stream>"
). ).
-define(HOST_UNKNOWN_ERR,
"<stream:stream "
"xmlns:stream='http://etherx.jabber.org/streams'>"
"<stream:error>Host Unknown</stream:error>"
"</stream:stream>"
).
-define(INVALID_HANDSHAKE_ERR, -define(INVALID_HANDSHAKE_ERR,
"<stream:error>Invalid Handshake</stream:error>" "<stream:error>Invalid Handshake</stream:error>"
"</stream:stream>" "</stream:stream>"
@ -178,19 +171,15 @@ init([{SockMod, Socket}, Opts]) ->
wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) -> wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
case xml:get_attr_s("xmlns", Attrs) of case xml:get_attr_s("xmlns", Attrs) of
"jabber:component:accept" -> "jabber:component:accept" ->
%% Check that destination is a served component %% Note: XEP-0114 requires to check that destination is a Jabber
%% component served by this Jabber server.
%% However several transports don't respect that,
%% so ejabberd doesn't check 'to' attribute (EJAB-717)
To = xml:get_attr_s("to", Attrs), To = xml:get_attr_s("to", Attrs),
case lists:member(To, StateData#state.hosts) of Header = io_lib:format(?STREAM_HEADER,
true -> [StateData#state.streamid, xml:crypt(To)]),
Header = io_lib:format(?STREAM_HEADER, send_text(StateData, Header),
[StateData#state.streamid, {next_state, wait_for_handshake, StateData};
xml:crypt(To)]),
send_text(StateData, Header),
{next_state, wait_for_handshake, StateData};
_ ->
send_text(StateData, ?HOST_UNKNOWN_ERR),
{stop, normal, StateData}
end;
_ -> _ ->
send_text(StateData, ?INVALID_HEADER_ERR), send_text(StateData, ?INVALID_HEADER_ERR),
{stop, normal, StateData} {stop, normal, StateData}