Skip to content
Browse files

Add configuration option to automatically trust and override s2s dial…

…back.
  • Loading branch information...
1 parent 8c942e3 commit c914699c3eb3c32a362ad4035bebc2eeb1a2c09f Shaun Kruger committed with root Jan 6, 2012
Showing with 11 additions and 2 deletions.
  1. +11 −2 src/ejabberd_s2s_in.erl
View
13 src/ejabberd_s2s_in.erl
@@ -70,7 +70,8 @@
authenticated = false,
auth_domain,
connections = ?DICT:new(),
- timer}).
+ timer,
+ dialback_verify=true}).
%-define(DBGFSM, true).
@@ -143,6 +144,10 @@ init([{SockMod, Socket}, Opts]) ->
CertFile ->
[{certfile, CertFile}]
end,
+ DialbackVerify = case proplists:get_value(dialback_verify_disable,Opts,false) of
+ true ->false;
+ _ -> true
+ end,
Timer = erlang:start_timer(?S2STIMEOUT, self(), []),
{ok, wait_for_stream,
#state{socket = Socket,
@@ -154,6 +159,7 @@ init([{SockMod, Socket}, Opts]) ->
tls_required = TLSRequired,
tls_certverify = TLSCertverify,
tls_options = TLSOpts,
+ dialback_verify=DialbackVerify,
timer = Timer}}.
%%----------------------------------------------------------------------
@@ -385,7 +391,7 @@ stream_established({xmlstreamelement, El}, StateData) ->
%% domain is handled by this server:
case {ejabberd_s2s:allow_host(LTo, LFrom),
lists:member(LTo, ejabberd_router:dirty_get_all_domains())} of
- {true, true} ->
+ {true, true} when StateData#state.dialback_verify ->
ejabberd_s2s_out:terminate_if_waiting_delay(LTo, LFrom),
ejabberd_s2s_out:start(LTo, LFrom,
{verify, self(),
@@ -398,6 +404,9 @@ stream_established({xmlstreamelement, El}, StateData) ->
stream_established,
StateData#state{connections = Conns,
timer = Timer}};
+ {true,true} ->
+ gen_fsm:send_event(self(),{valid,From,To}),
+ {next_state,stream_established,StateData#state{timer=Timer}};
{_, false} ->
send_element(StateData, exmpp_stream:error('host-unknown')),
{stop, normal, StateData};

0 comments on commit c914699

Please sign in to comment.
Something went wrong with that request. Please try again.