summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Nilsson <hans@erlang.org>2020-06-15 16:39:24 +0200
committerHans Nilsson <hans@erlang.org>2020-06-16 11:44:25 +0200
commitf381a47a26da339d9bb2e08df8bf65460671d640 (patch)
treee0de1372eb0d817b7870b11841920ce4ea30cba2
parent67de05f32fec56aa7d549fb11c5dbc9b783bd217 (diff)
downloaderlang-f381a47a26da339d9bb2e08df8bf65460671d640.tar.gz
ssh: Test {tsflg,[{one_more,true}]}
which tests a server requiring an extra message
-rw-r--r--lib/ssh/src/ssh_message.erl2
-rw-r--r--lib/ssh/test/ssh_options_SUITE.erl25
2 files changed, 25 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_message.erl b/lib/ssh/src/ssh_message.erl
index 804775bd75..12de0f83c2 100644
--- a/lib/ssh/src/ssh_message.erl
+++ b/lib/ssh/src/ssh_message.erl
@@ -690,6 +690,8 @@ bin_foldl(Fun, Acc0, Bin0) ->
%%%----------------------------------------------------------------
decode_keyboard_interactive_prompts(<<>>, Acc) ->
lists:reverse(Acc);
+decode_keyboard_interactive_prompts(<<0>>, Acc) ->
+ lists:reverse(Acc);
decode_keyboard_interactive_prompts(<<?DEC_BIN(Prompt,__0), ?BYTE(Bool), Bin/binary>>,
Acc) ->
decode_keyboard_interactive_prompts(Bin, [{Prompt, erl_boolean(Bool)} | Acc]).
diff --git a/lib/ssh/test/ssh_options_SUITE.erl b/lib/ssh/test/ssh_options_SUITE.erl
index 5769cc8f0a..7c222c9b06 100644
--- a/lib/ssh/test/ssh_options_SUITE.erl
+++ b/lib/ssh/test/ssh_options_SUITE.erl
@@ -50,6 +50,7 @@
server_pwdfun_option/1,
server_pwdfun_4_option/1,
server_keyboard_interactive/1,
+ server_keyboard_interactive_extra_msg/1,
ssh_connect_arg4_timeout/1,
ssh_connect_negtimeout_parallel/1,
ssh_connect_negtimeout_sequential/1,
@@ -103,6 +104,7 @@ all() ->
server_pwdfun_option,
server_pwdfun_4_option,
server_keyboard_interactive,
+ server_keyboard_interactive_extra_msg,
auth_method_kb_interactive_data_tuple,
auth_method_kb_interactive_data_fun3,
auth_method_kb_interactive_data_fun4,
@@ -390,7 +392,7 @@ server_pwdfun_4_option(Config) ->
%%--------------------------------------------------------------------
server_keyboard_interactive(Config) ->
UserDir = proplists:get_value(user_dir, Config),
- SysDir = proplists:get_value(data_dir, Config),
+ SysDir = proplists:get_value(data_dir, Config),
%% Test that the state works
Parent = self(),
PWDFUN = fun("foo",P="bar",_,S) -> Parent!{P,S},true;
@@ -445,7 +447,26 @@ server_keyboard_interactive(Config) ->
end, [{"incorrect",undefined},
{"Bad again",1},
{"bar",2}]).
-
+
+%%--------------------------------------------------------------------
+server_keyboard_interactive_extra_msg(Config) ->
+ UserDir = proplists:get_value(user_dir, Config),
+ SysDir = proplists:get_value(data_dir, Config),
+ {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir},
+ {user_dir, UserDir},
+ {auth_methods,"keyboard-interactive"},
+ {tstflg, [{one_empty,true}]},
+ {user_passwords, [{"foo","bar"}]}
+ ]),
+
+ ConnectionRef =
+ ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true},
+ {user, "foo"},
+ {password, "bar"},
+ {user_dir, UserDir}]),
+ ssh:close(ConnectionRef),
+ ssh:stop_daemon(Pid).
+
%%--------------------------------------------------------------------
auth_method_kb_interactive_data_tuple(Config) ->
T = {"abc1", "def1", "ghi1: ", true},