aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans <[email protected]>2015-05-28 20:58:28 +0200
committerHans <[email protected]>2015-05-29 15:00:21 +0200
commit4cb16a7ed0f0491ccf8defbeb62a9b0e96923372 (patch)
tree0981f14659fd0aaf23105759845b13492c11b53e
parent2d9a5afcd801837be7637048977982bd9e1330f5 (diff)
downloadotp-4cb16a7ed0f0491ccf8defbeb62a9b0e96923372.tar.gz
otp-4cb16a7ed0f0491ccf8defbeb62a9b0e96923372.tar.bz2
otp-4cb16a7ed0f0491ccf8defbeb62a9b0e96923372.zip
ssh: Plain text message returned for invalid version exchange
This is how OpenSSH does. The bytes returned will be put on the user's tty, so it is better with text than a ssh_msg_disconnect
-rw-r--r--lib/ssh/src/ssh_connection_handler.erl13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl
index 3161c1f291..bc652b81b8 100644
--- a/lib/ssh/src/ssh_connection_handler.erl
+++ b/lib/ssh/src/ssh_connection_handler.erl
@@ -335,13 +335,12 @@ hello({info_line, _Line},#state{role = client, socket = Socket} = State) ->
inet:setopts(Socket, [{active, once}]),
{next_state, hello, State};
-hello({info_line, _Line},#state{role = server} = State) ->
- DisconnectMsg =
- #ssh_msg_disconnect{code =
- ?SSH_DISCONNECT_PROTOCOL_ERROR,
- description = "Did not receive expected protocol version exchange",
- language = "en"},
- handle_disconnect(DisconnectMsg, State);
+hello({info_line, _Line},#state{role = server,
+ socket = Socket,
+ transport_cb = Transport } = State) ->
+ %% as openssh
+ Transport:send(Socket, "Protocol mismatch."),
+ {stop, {shutdown,"Protocol mismatch in version exchange."}, State};
hello({version_exchange, Version}, #state{ssh_params = Ssh0,
socket = Socket,