mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
When TLS is required in s2s, add subelement to stream:features starttls
This commit is contained in:
parent
befb4fc7ea
commit
41fc44e55f
@ -62,6 +62,7 @@
|
|||||||
shaper,
|
shaper,
|
||||||
tls = false,
|
tls = false,
|
||||||
tls_enabled = false,
|
tls_enabled = false,
|
||||||
|
tls_required = false,
|
||||||
tls_options = [],
|
tls_options = [],
|
||||||
server,
|
server,
|
||||||
authenticated = false,
|
authenticated = false,
|
||||||
@ -122,11 +123,13 @@ init([{SockMod, Socket}, Opts]) ->
|
|||||||
{value, {_, S}} -> S;
|
{value, {_, S}} -> S;
|
||||||
_ -> none
|
_ -> none
|
||||||
end,
|
end,
|
||||||
StartTLS = case ejabberd_config:get_local_option(s2s_use_starttls) of
|
{StartTLS, TLSRequired} = case ejabberd_config:get_local_option(s2s_use_starttls) of
|
||||||
undefined ->
|
UseTls when (UseTls==undefined) or (UseTls==false) ->
|
||||||
false;
|
{false, false};
|
||||||
UseStartTLS ->
|
UseTls when (UseTls==true) or (UseTls==optional) ->
|
||||||
UseStartTLS
|
{true, false};
|
||||||
|
required ->
|
||||||
|
{true, true}
|
||||||
end,
|
end,
|
||||||
TLSOpts = case ejabberd_config:get_local_option(s2s_certfile) of
|
TLSOpts = case ejabberd_config:get_local_option(s2s_certfile) of
|
||||||
undefined ->
|
undefined ->
|
||||||
@ -142,6 +145,7 @@ init([{SockMod, Socket}, Opts]) ->
|
|||||||
shaper = Shaper,
|
shaper = Shaper,
|
||||||
tls = StartTLS,
|
tls = StartTLS,
|
||||||
tls_enabled = false,
|
tls_enabled = false,
|
||||||
|
tls_required = TLSRequired,
|
||||||
tls_options = TLSOpts,
|
tls_options = TLSOpts,
|
||||||
timer = Timer}}.
|
timer = Timer}}.
|
||||||
|
|
||||||
@ -186,8 +190,8 @@ wait_for_stream({xmlstreamstart, Opening}, StateData) ->
|
|||||||
StartTLS = if
|
StartTLS = if
|
||||||
StateData#state.tls_enabled ->
|
StateData#state.tls_enabled ->
|
||||||
[];
|
[];
|
||||||
true ->
|
(not StateData#state.tls_enabled) ->
|
||||||
[exmpp_server_tls:feature()]
|
[exmpp_server_tls:feature(StateData#state.tls_required)]
|
||||||
end,
|
end,
|
||||||
Features = SASL ++ StartTLS ++ ejabberd_hooks:run_fold(
|
Features = SASL ++ StartTLS ++ ejabberd_hooks:run_fold(
|
||||||
c2s_stream_features,
|
c2s_stream_features,
|
||||||
|
Loading…
Reference in New Issue
Block a user