aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2019-07-01 17:00:48 +0200
committerIngela Anderton Andin <[email protected]>2019-07-01 17:56:15 +0200
commitab61a13a824339d69a4e3955a21be12cb804d960 (patch)
tree398848cb762a85995d85b291fa087358001c72fd /lib
parent4319a7f8bc93388ec540e954eb9bb73ea1eec4ef (diff)
downloadotp-ab61a13a824339d69a4e3955a21be12cb804d960.tar.gz
otp-ab61a13a824339d69a4e3955a21be12cb804d960.tar.bz2
otp-ab61a13a824339d69a4e3955a21be12cb804d960.zip
ssl: Enhance error handling
Handle the ILLEGAL_PARAMETER alert that may be returned from ssl_alert:decode/3 for gracefull shutdown, try of ...catch will/should not handle this case it is only handles the case that TM should not happen!
Diffstat (limited to 'lib')
-rw-r--r--lib/ssl/src/tls_connection.erl5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/ssl/src/tls_connection.erl b/lib/ssl/src/tls_connection.erl
index 7cc2adfda1..8e850b48a4 100644
--- a/lib/ssl/src/tls_connection.erl
+++ b/lib/ssl/src/tls_connection.erl
@@ -335,7 +335,9 @@ handle_protocol_record(#ssl_tls{type = ?ALERT, fragment = EncAlerts}, StateName,
handle_alerts(Alerts, {next_state, StateName, State});
[] ->
ssl_connection:handle_own_alert(?ALERT_REC(?FATAL, ?HANDSHAKE_FAILURE, empty_alert),
- Version, StateName, State)
+ Version, StateName, State);
+ #alert{} = Alert ->
+ ssl_connection:handle_own_alert(Alert, Version, StateName, State)
catch
_:_ ->
ssl_connection:handle_own_alert(?ALERT_REC(?FATAL, ?HANDSHAKE_FAILURE, alert_decode_error),
@@ -1162,7 +1164,6 @@ encode_handshake(Handshake, Version, ConnectionStates0, Hist0) ->
encode_change_cipher(#change_cipher_spec{}, Version, ConnectionStates) ->
tls_record:encode_change_cipher_spec(Version, ConnectionStates).
--spec decode_alerts(binary()) -> list().
decode_alerts(Bin) ->
ssl_alert:decode(Bin).