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

* src/ejabberd_s2s_in.erl: Fixed "id" attribute processing

* src/ejabberd_s2s_out.erl: Likewise

* src/ejabberd_c2s.erl: Added sending of empty <stream:features/>
element after opening of authentificated stream

SVN Revision: 135
This commit is contained in:
Alexey Shchepin 2003-09-03 17:49:42 +00:00
parent dc80fa1562
commit de6b2a2996
5 changed files with 35 additions and 41 deletions

View File

@ -1,3 +1,11 @@
2003-09-03 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_s2s_in.erl: Fixed "id" attribute processing
* src/ejabberd_s2s_out.erl: Likewise
* src/ejabberd_c2s.erl: Added sending of empty <stream:features/>
element after opening of authentificated stream
2003-09-02 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_s2s_in.erl: Temporary hack for "id" attribute
@ -111,7 +119,7 @@
2003-07-05 Alexey Shchepin <alexey@sevcom.net>
* src/jlib.hrl: Added pub/sub nemaspaces
* src/jlib.hrl: Added pub/sub namespaces
2003-07-03 Alexey Shchepin <alexey@sevcom.net>
@ -221,7 +229,7 @@
2003-05-08 Alexey Shchepin <alexey@sevcom.net>
* src/mod_muc/mod_muc.erl: Denied using of empty nick
* src/mod_muc/mod_muc.erl: Denied usage of empty nick
2003-05-07 Alexey Shchepin <alexey@sevcom.net>

3
TODO
View File

@ -8,7 +8,8 @@ admin interface
backup management
S2S:
* rewrite S2S key validation
rewrite S2S key validation
check "id" attributes in db:verify packets
more correctly work with SRV DNS records (priority, weight, etc...)
TLS

View File

@ -133,13 +133,15 @@ wait_for_stream({xmlstreamstart, Name, Attrs}, StateData) ->
?MYNAME,
" version='1.0'"]),
send_text(StateData, Header),
SASLState = cyrsasl:server_new("jabber", ?MYNAME, "", []),
Mechs = lists:map(fun(S) ->
case StateData#state.authentificated of
false ->
SASLState =
cyrsasl:server_new("jabber", ?MYNAME, "", []),
Mechs = lists:map(
fun(S) ->
{xmlelement, "mechanism", [],
[{xmlcdata, S}]}
end, cyrsasl:listmech()),
case StateData#state.authentificated of
false ->
send_element(StateData,
{xmlelement, "stream:features", [],
[{xmlelement, "mechanisms",
@ -148,6 +150,9 @@ wait_for_stream({xmlstreamstart, Name, Attrs}, StateData) ->
{next_state, wait_for_sasl_auth,
StateData#state{sasl_state = SASLState}};
_ ->
send_element(
StateData,
{xmlelement, "stream:features", [], []}),
{next_state, wait_for_session, StateData}
end;
_ ->

View File

@ -42,12 +42,12 @@
-endif.
-define(STREAM_HEADER,
"<?xml version='1.0'?>"
"<stream:stream "
"xmlns:stream='http://etherx.jabber.org/streams' "
"xmlns='jabber:server' "
"xmlns:db='jabber:server:dialback' "
"id='todo'>"
("<?xml version='1.0'?>"
"<stream:stream "
"xmlns:stream='http://etherx.jabber.org/streams' "
"xmlns='jabber:server' "
"xmlns:db='jabber:server:dialback' "
"id='" ++ StateData#state.streamid ++ "'>")
).
-define(STREAM_TRAILER, "</stream:stream>").
@ -139,7 +139,8 @@ wait_for_key({xmlstreamelement, El}, StateData) ->
case lists:member(To, ejabberd_router:dirty_get_all_domains()) of
true ->
ejabberd_s2s_out:start(To, From,
{verify, self(), Key}),
{verify, self(),
Key, StateData#state.streamid}),
{next_state,
wait_for_verification,
StateData#state{myname = To,

View File

@ -88,8 +88,8 @@ init([From, Server, Type]) ->
{New, Verify} = case Type of
{new, Key} ->
{Key, false};
{verify, Pid, Key} ->
{false, {Pid, Key}}
{verify, Pid, Key, SID} ->
{false, {Pid, Key, SID}}
end,
{ok, open_socket, #state{queue = queue:new(),
myname = From,
@ -162,13 +162,13 @@ wait_for_stream({xmlstreamstart, Name, Attrs}, StateData) ->
case StateData#state.verify of
false ->
ok;
{Pid, Key2} ->
{Pid, Key2, SID} ->
send_element(StateData#state.socket,
{xmlelement,
"db:verify",
[{"from", StateData#state.myname},
{"to", StateData#state.server},
{"id", "todo"}],
{"id", SID}],
[{xmlcdata, Key2}]})
end,
{next_state, wait_for_validation,
@ -208,7 +208,7 @@ wait_for_validation({xmlstreamelement, El}, StateData) ->
case StateData#state.verify of
false ->
{next_state, wait_for_validation, StateData, ?S2STIMEOUT};
{Pid, Key} ->
{Pid, _Key, _SID} ->
case Type of
"valid" ->
gen_fsm:send_event(Pid, valid);
@ -242,7 +242,7 @@ stream_established({xmlstreamelement, El}, StateData) ->
{verify, VTo, VFrom, VId, VType} ->
?INFO_MSG("recv verify: ~p", [{VFrom, VTo, VId, VType}]),
case StateData#state.verify of
{VPid, VKey} ->
{VPid, _VKey, _SID} ->
case VType of
"valid" ->
gen_fsm:send_event(VPid, valid);
@ -255,27 +255,6 @@ stream_established({xmlstreamelement, El}, StateData) ->
_ ->
ok
end,
%{xmlelement, Name, Attrs, Els} = El,
%From = xml:get_attr_s("from", Attrs),
%FromJID1 = jlib:string_to_jid(From),
%FromJID = case FromJID1 of
% {Node, Server, Resource} ->
% if Server == StateData#state.server -> FromJID1;
% true -> error
% end;
% _ -> error
% end,
%To = xml:get_attr_s("to", Attrs),
%ToJID = case To of
% "" -> error;
% _ -> jlib:string_to_jid(To)
% end,
%if ((Name == "iq") or (Name == "message") or (Name == "presence")) and
% (ToJID /= error) and (FromJID /= error) ->
% ejabberd_router:route(FromJID, ToJID, El);
% true ->
% error
%end,
{next_state, stream_established, StateData, ?S2STIMEOUT};
stream_established({xmlstreamend, Name}, StateData) ->