diff options
author | Fredrik Gustafsson <[email protected]> | 2013-02-15 11:35:38 +0100 |
---|---|---|
committer | Fredrik Gustafsson <[email protected]> | 2013-02-15 11:35:38 +0100 |
commit | f87220291781edc8145884ace92c0372271fe35f (patch) | |
tree | a551f20dd31ec30c8a309fac647474541783ea7c /lib/ssh/src/ssh_connection_handler.erl | |
parent | ad9e9bc79f01451df7f18f79a9b44afb71b05851 (diff) | |
parent | c0891cdfe9aaae96f95cc45b9a07271ad9a5a07c (diff) | |
download | otp-f87220291781edc8145884ace92c0372271fe35f.tar.gz otp-f87220291781edc8145884ace92c0372271fe35f.tar.bz2 otp-f87220291781edc8145884ace92c0372271fe35f.zip |
Merge branch 'fredrik/ssh/better-error-messages/OTP-10553'
* fredrik/ssh/better-error-messages/OTP-10553:
Added event/3 and clarified error message
Error msg to be returned together with Key exchange failed
Returning the actual reason why key exchange failed
Diffstat (limited to 'lib/ssh/src/ssh_connection_handler.erl')
-rw-r--r-- | lib/ssh/src/ssh_connection_handler.erl | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl index 787d82c4db..74a6ac7d19 100644 --- a/lib/ssh/src/ssh_connection_handler.erl +++ b/lib/ssh/src/ssh_connection_handler.erl @@ -223,11 +223,13 @@ key_exchange(#ssh_msg_kexdh_reply{} = Msg, catch #ssh_msg_disconnect{} = DisconnectMsg -> handle_disconnect(DisconnectMsg, State); + {ErrorToDisplay, #ssh_msg_disconnect{} = DisconnectMsg} -> + handle_disconnect(DisconnectMsg, State, ErrorToDisplay); _:Error -> Desc = log_error(Error), handle_disconnect(#ssh_msg_disconnect{code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, - description = Desc, - language = "en"}, State) + description = Desc, + language = "en"}, State) end; key_exchange(#ssh_msg_kex_dh_gex_group{} = Msg, @@ -673,6 +675,11 @@ terminate({shutdown, #ssh_msg_disconnect{} = Msg}, StateName, #state{ssh_params send_msg(SshPacket, State), ssh_connection_manager:event(Pid, Msg), terminate(normal, StateName, State#state{ssh_params = Ssh}); +terminate({shutdown, {#ssh_msg_disconnect{} = Msg, ErrorMsg}}, StateName, #state{ssh_params = Ssh0, manager = Pid} = State) -> + {SshPacket, Ssh} = ssh_transport:ssh_packet(Msg, Ssh0), + send_msg(SshPacket, State), + ssh_connection_manager:event(Pid, Msg, ErrorMsg), + terminate(normal, StateName, State#state{ssh_params = Ssh}); terminate(Reason, StateName, #state{ssh_params = Ssh0, manager = Pid} = State) -> log_error(Reason), DisconnectMsg = @@ -950,6 +957,8 @@ handle_ssh_packet(Length, StateName, #state{decoded_data_buffer = DecData0, handle_disconnect(#ssh_msg_disconnect{} = Msg, State) -> {stop, {shutdown, Msg}, State}. +handle_disconnect(#ssh_msg_disconnect{} = Msg, State, ErrorMsg) -> + {stop, {shutdown, {Msg, ErrorMsg}}, State}. counterpart_versions(NumVsn, StrVsn, #ssh{role = server} = Ssh) -> Ssh#ssh{c_vsn = NumVsn , c_version = StrVsn}; |