aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2019-04-17 16:21:48 +0200
committerHans Nilsson <[email protected]>2019-04-18 14:04:15 +0200
commit167892981042f4a5eb4ac76a1e5a532d5ce65b65 (patch)
tree9043dc669b45f0f1f355c52445889d501665b62f
parent0e68bacac2540e500087126dec6a75174cffa9e0 (diff)
downloadotp-167892981042f4a5eb4ac76a1e5a532d5ce65b65.tar.gz
otp-167892981042f4a5eb4ac76a1e5a532d5ce65b65.tar.bz2
otp-167892981042f4a5eb4ac76a1e5a532d5ce65b65.zip
ssh: Dump 64 bytes in case of unexpected info line
-rw-r--r--lib/ssh/src/ssh_connection_handler.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl
index 7c87591cf2..8f32966a12 100644
--- a/lib/ssh/src/ssh_connection_handler.erl
+++ b/lib/ssh/src/ssh_connection_handler.erl
@@ -594,7 +594,7 @@ handle_event(_, socket_control, {hello,_}=StateName, D) ->
{stop, {shutdown,{unexpected_getopts_return, Other}}}
end;
-handle_event(_, {info_line,_Line}, {hello,Role}=StateName, D) ->
+handle_event(_, {info_line,Line}, {hello,Role}=StateName, D) ->
case Role of
client ->
%% The server may send info lines to the client before the version_exchange
@@ -605,9 +605,9 @@ handle_event(_, {info_line,_Line}, {hello,Role}=StateName, D) ->
%% But the client may NOT send them to the server. Openssh answers with cleartext,
%% and so do we
send_bytes("Protocol mismatch.", D),
- ?call_disconnectfun_and_log_cond("Protocol mismatch.",
- "Protocol mismatch in version exchange. Client sent info lines.",
- StateName, D),
+ Msg = io_lib:format("Protocol mismatch in version exchange. Client sent info lines.~n~s",
+ [ssh_dbg:hex_dump(Line, 64)]),
+ ?call_disconnectfun_and_log_cond("Protocol mismatch.", Msg, StateName, D),
{stop, {shutdown,"Protocol mismatch in version exchange. Client sent info lines."}}
end;