From dde4bc77cd5be76102cd913c1c931844856ad76e Mon Sep 17 00:00:00 2001 From: Fredrik Gustafsson Date: Thu, 8 Nov 2012 13:47:33 +0100 Subject: Returning the actual reason why key exchange failed --- lib/ssh/src/ssh_transport.erl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/ssh/src/ssh_transport.erl') diff --git a/lib/ssh/src/ssh_transport.erl b/lib/ssh/src/ssh_transport.erl index 1abb69921d..8f81cdde5e 100644 --- a/lib/ssh/src/ssh_transport.erl +++ b/lib/ssh/src/ssh_transport.erl @@ -356,12 +356,18 @@ handle_kexdh_reply(#ssh_msg_kexdh_reply{public_host_key = HostKey, f = F, {ok, SshPacket, Ssh#ssh{shared_secret = K, exchanged_hash = H, session_id = sid(Ssh, H)}}; - _Error -> + Error -> Disconnect = #ssh_msg_disconnect{ code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, description = "Key exchange failed", language = "en"}, - throw(Disconnect) + ErrorMsg = case Error of + {error, rejected} -> + {error, {rejected, {hostkey, HostKey}}}; + _ -> + Error + end, + throw({ErrorMsg, Disconnect}) end. handle_kex_dh_gex_request(#ssh_msg_kex_dh_gex_request{min = _Min, -- cgit v1.2.3