aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2013-08-08 15:50:26 +0200
committerIngela Anderton Andin <[email protected]>2013-08-08 15:50:26 +0200
commitd7ac9ac072f9262f02c821442b33701e33bad2e6 (patch)
tree6f4d64ead87b3c94d3ab9b33a7d6ef3ddcba23d9
parenta2b69f4fcc3c0817a1d927345768b5a3047f4d73 (diff)
parentcd0097cd26a5b6bbf653bdd7d89e94658b19e764 (diff)
downloadotp-d7ac9ac072f9262f02c821442b33701e33bad2e6.tar.gz
otp-d7ac9ac072f9262f02c821442b33701e33bad2e6.tar.bz2
otp-d7ac9ac072f9262f02c821442b33701e33bad2e6.zip
Merge branch 'ia/ssl/setopt-renegotiation-bug/OTP-11228' into maint
* ia/ssl/setopt-renegotiation-bug/OTP-11228: ssl: Setopts during renegotiation caused the renegotiation to be unsuccessful.
-rw-r--r--lib/ssl/src/tls_connection.erl12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/ssl/src/tls_connection.erl b/lib/ssl/src/tls_connection.erl
index 246fecf34a..2178e8ee09 100644
--- a/lib/ssl/src/tls_connection.erl
+++ b/lib/ssl/src/tls_connection.erl
@@ -978,7 +978,7 @@ handle_sync_event(negotiated_next_protocol, _From, StateName, #state{next_protoc
handle_sync_event(negotiated_next_protocol, _From, StateName, #state{next_protocol = NextProtocol} = State) ->
{reply, {ok, NextProtocol}, StateName, State, get_timeout(State)};
-handle_sync_event({set_opts, Opts0}, _From, StateName,
+handle_sync_event({set_opts, Opts0}, _From, StateName0,
#state{socket_options = Opts1,
socket = Socket,
transport_cb = Transport,
@@ -987,11 +987,12 @@ handle_sync_event({set_opts, Opts0}, _From, StateName,
State1 = State0#state{socket_options = Opts},
if
Opts#socket_options.active =:= false ->
- {reply, Reply, StateName, State1, get_timeout(State1)};
+ {reply, Reply, StateName0, State1, get_timeout(State1)};
Buffer =:= <<>>, Opts1#socket_options.active =:= false ->
%% Need data, set active once
{Record, State2} = next_record_if_active(State1),
- case next_state(StateName, StateName, Record, State2) of
+ %% Note: Renogotiation may cause StateName0 =/= StateName
+ case next_state(StateName0, StateName0, Record, State2) of
{next_state, StateName, State, Timeout} ->
{reply, Reply, StateName, State, Timeout};
{stop, Reason, State} ->
@@ -999,13 +1000,14 @@ handle_sync_event({set_opts, Opts0}, _From, StateName,
end;
Buffer =:= <<>> ->
%% Active once already set
- {reply, Reply, StateName, State1, get_timeout(State1)};
+ {reply, Reply, StateName0, State1, get_timeout(State1)};
true ->
case read_application_data(<<>>, State1) of
Stop = {stop,_,_} ->
Stop;
{Record, State2} ->
- case next_state(StateName, StateName, Record, State2) of
+ %% Note: Renogotiation may cause StateName0 =/= StateName
+ case next_state(StateName0, StateName0, Record, State2) of
{next_state, StateName, State, Timeout} ->
{reply, Reply, StateName, State, Timeout};
{stop, Reason, State} ->