aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2018-12-27 10:45:52 +0100
committerErlang/OTP <[email protected]>2018-12-27 10:45:52 +0100
commit92a8fcdbfa0fc5ed65cf0d45ab2711cc3dd2a493 (patch)
treef13957c89317a3da1365ccf70c79b6349bcf6c60 /lib/ssh/test
parent5da29dab1d0de935b37cbfc9018d0d01955f1f48 (diff)
parent9b8575437a3c84eab77453279d8844c52485216c (diff)
downloadotp-92a8fcdbfa0fc5ed65cf0d45ab2711cc3dd2a493.tar.gz
otp-92a8fcdbfa0fc5ed65cf0d45ab2711cc3dd2a493.tar.bz2
otp-92a8fcdbfa0fc5ed65cf0d45ab2711cc3dd2a493.zip
Merge branch 'hans/ssh/port_leak/OTP-15397' into maint-21
* hans/ssh/port_leak/OTP-15397: ssh: Fix port leakage for daemons failing at start ssh: Add port close test # Conflicts: # lib/ssh/test/ssh_basic_SUITE.erl
Diffstat (limited to 'lib/ssh/test')
-rw-r--r--lib/ssh/test/ssh_basic_SUITE.erl22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl
index da94b5722f..5de6d52092 100644
--- a/lib/ssh/test/ssh_basic_SUITE.erl
+++ b/lib/ssh/test/ssh_basic_SUITE.erl
@@ -43,7 +43,9 @@ suite() ->
{timetrap,{seconds,40}}].
all() ->
- [{group, all_tests}].
+ [{group, all_tests},
+ daemon_already_started
+ ].
groups() ->
[{all_tests, [parallel], [{group, ssh_renegotiate_SUITE},
@@ -801,6 +803,24 @@ daemon_already_started(Config) when is_list(Config) ->
ssh:stop_daemon(Pid).
%%--------------------------------------------------------------------
+%%% Test that a failed daemon start does not leave the port open
+daemon_error_closes_port(Config) ->
+ GoodSystemDir = proplists:get_value(data_dir, Config),
+ Port = ssh_test_lib:inet_port(),
+ {error,_} = ssh_test_lib:daemon(Port, []), % No system dir
+ case ssh_test_lib:daemon(Port, [{system_dir, GoodSystemDir}]) of
+ {error,eaddrinuse} ->
+ {fail, "Port leakage"};
+ {error,Error} ->
+ ct:log("Strange error: ~p",[Error]),
+ {fail, "Strange error"};
+ {Pid, _Host, Port} ->
+ %% Ok
+ ssh:stop_daemon(Pid)
+ end.
+
+
+%%--------------------------------------------------------------------
%%% check that known_hosts is updated correctly
known_hosts(Config) when is_list(Config) ->
SystemDir = proplists:get_value(data_dir, Config),