aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2015-12-22 09:31:46 +0100
committerHans Nilsson <[email protected]>2015-12-22 09:31:46 +0100
commit2a729798aacfc7ce0e718d3b52e4915223a13e03 (patch)
treec3642afae0c4ecf29ec3b2012f19343e99e45b37 /lib/ssh/test
parentf7dabb38a90382bb1d0988468aaaa03dd7223038 (diff)
parent76bfd2ad384ed609949809c0c79605d915f6011e (diff)
downloadotp-2a729798aacfc7ce0e718d3b52e4915223a13e03.tar.gz
otp-2a729798aacfc7ce0e718d3b52e4915223a13e03.tar.bz2
otp-2a729798aacfc7ce0e718d3b52e4915223a13e03.zip
Merge branch 'maint'
* maint: ssh: add econnaborted to disconnect msgs in test suite ssh: fix the check that open-ssh supports certain pubkeys in a test suite
Diffstat (limited to 'lib/ssh/test')
-rw-r--r--lib/ssh/test/ssh_protocol_SUITE.erl47
-rw-r--r--lib/ssh/test/ssh_to_openssh_SUITE.erl4
2 files changed, 21 insertions, 30 deletions
diff --git a/lib/ssh/test/ssh_protocol_SUITE.erl b/lib/ssh/test/ssh_protocol_SUITE.erl
index 5af60adfae..4c088acabf 100644
--- a/lib/ssh/test/ssh_protocol_SUITE.erl
+++ b/lib/ssh/test/ssh_protocol_SUITE.erl
@@ -277,12 +277,7 @@ no_common_alg_server_disconnects(Config) ->
{send, hello},
{match, #ssh_msg_kexinit{_='_'}, receive_msg},
{send, ssh_msg_kexinit}, % with server unsupported 'ssh-dss' !
- {match,
- {'or',[#ssh_msg_disconnect{code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, _='_'},
- tcp_closed,
- {tcp_error,econnaborted}
- ]},
- receive_msg}
+ {match, disconnect(), receive_msg}
]
).
@@ -323,10 +318,7 @@ no_common_alg_client_disconnects(Config) ->
first_kex_packet_follows = false,
reserved = 0
}},
- {match,
- {'or',[#ssh_msg_disconnect{code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED, _='_'},
- tcp_closed]},
- receive_msg}
+ {match, disconnect(?SSH_DISCONNECT_KEY_EXCHANGE_FAILED), receive_msg}
],
InitialState)
}
@@ -437,10 +429,7 @@ bad_service_name_then_correct(Config) ->
[{set_options, [print_ops, print_seqnums, print_messages]},
{send, #ssh_msg_service_request{name = "kdjglkfdjgkldfjglkdfjglkfdjglkj"}},
{send, #ssh_msg_service_request{name = "ssh-connection"}},
- {match, {'or',[#ssh_msg_disconnect{_='_'},
- tcp_closed
- ]},
- receive_msg}
+ {match, disconnect(), receive_msg}
], InitialState).
@@ -450,10 +439,7 @@ bad_service_name(Config, Name) ->
ssh_trpt_test_lib:exec(
[{set_options, [print_ops, print_seqnums, print_messages]},
{send, #ssh_msg_service_request{name = Name}},
- {match, {'or',[#ssh_msg_disconnect{_='_'},
- tcp_closed
- ]},
- receive_msg}
+ {match, disconnect(), receive_msg}
], InitialState).
%%%--------------------------------------------------------------------
@@ -476,11 +462,7 @@ bad_packet_length(Config, LengthExcess) ->
PacketFun}},
%% Prohibit remote decoder starvation:
{send, #ssh_msg_service_request{name="ssh-userauth"}},
- {match, {'or',[#ssh_msg_disconnect{_='_'},
- tcp_closed,
- {tcp_error,econnaborted}
- ]},
- receive_msg}
+ {match, disconnect(), receive_msg}
], InitialState).
%%%--------------------------------------------------------------------
@@ -509,11 +491,7 @@ bad_service_name_length(Config, LengthExcess) ->
PacketFun} },
%% Prohibit remote decoder starvation:
{send, #ssh_msg_service_request{name="ssh-userauth"}},
- {match, {'or',[#ssh_msg_disconnect{_='_'},
- tcp_closed,
- {tcp_error,econnaborted}
- ]},
- receive_msg}
+ {match, disconnect(), receive_msg}
], InitialState).
%%%================================================================
@@ -644,3 +622,16 @@ connect_and_kex(Config, InitialState) ->
{match, #ssh_msg_newkeys{_='_'}, receive_msg}
],
InitialState).
+
+%%%----------------------------------------------------------------
+
+%%% For matching peer disconnection
+disconnect() ->
+ disconnect('_').
+
+disconnect(Code) ->
+ {'or',[#ssh_msg_disconnect{code = Code,
+ _='_'},
+ tcp_closed,
+ {tcp_error,econnaborted}
+ ]}.
diff --git a/lib/ssh/test/ssh_to_openssh_SUITE.erl b/lib/ssh/test/ssh_to_openssh_SUITE.erl
index 02cc79e4d5..67a61d3c11 100644
--- a/lib/ssh/test/ssh_to_openssh_SUITE.erl
+++ b/lib/ssh/test/ssh_to_openssh_SUITE.erl
@@ -110,9 +110,9 @@ end_per_testcase(_TestCase, _Config) ->
chk_key(Pgm, Name, File, Config) ->
case ssh_test_lib:openssh_supports(Pgm, public_key, Name) of
- true ->
- {skip,lists:concat(["openssh client does not support ",Name])};
false ->
+ {skip,lists:concat(["openssh client does not support ",Name])};
+ true ->
{ok,[[Home]]} = init:get_argument(home),
KeyFile = filename:join(Home, File),
case file:read_file(KeyFile) of