aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2012-02-14 15:23:59 +0100
committerIngela Anderton Andin <[email protected]>2012-02-14 15:23:59 +0100
commitae4e722461812bb1d7b5d5243c90404a1bcb57be (patch)
treebbbaa9e77f3aa33f22c4fe2e39972d7aaf4e4922 /lib/ssh
parent42550aa765f0336aaa103f059491d2f6a7df3a51 (diff)
parent0580ac8b2aaec67f7df11f1439e77c3c4778a92f (diff)
downloadotp-ae4e722461812bb1d7b5d5243c90404a1bcb57be.tar.gz
otp-ae4e722461812bb1d7b5d5243c90404a1bcb57be.tar.bz2
otp-ae4e722461812bb1d7b5d5243c90404a1bcb57be.zip
Merge branch 'ia/ssh/keyboard-interactive-disable-bug/OTP-9466' into maint
* ia/ssh/keyboard-interactive-disable-bug/OTP-9466: Client now honors the allow_user_interaction option
Diffstat (limited to 'lib/ssh')
-rw-r--r--lib/ssh/src/ssh_auth.erl36
1 files changed, 25 insertions, 11 deletions
diff --git a/lib/ssh/src/ssh_auth.erl b/lib/ssh/src/ssh_auth.erl
index a2e74a12bb..62d684f4dc 100644
--- a/lib/ssh/src/ssh_auth.erl
+++ b/lib/ssh/src/ssh_auth.erl
@@ -71,29 +71,43 @@ password_msg([#ssh{opts = Opts, io_cb = IoCb,
ssh_bits:install_messages(userauth_passwd_messages()),
Password = case proplists:get_value(password, Opts) of
undefined ->
- IoCb:read_password("ssh password: ");
+ user_interaction(Opts, IoCb);
PW ->
PW
end,
- ssh_transport:ssh_packet(
- #ssh_msg_userauth_request{user = User,
- service = Service,
- method = "password",
- data =
- <<?BOOLEAN(?FALSE),
- ?STRING(list_to_binary(Password))>>},
- Ssh).
+ case Password of
+ not_ok ->
+ not_ok;
+ _ ->
+ ssh_transport:ssh_packet(
+ #ssh_msg_userauth_request{user = User,
+ service = Service,
+ method = "password",
+ data =
+ <<?BOOLEAN(?FALSE),
+ ?STRING(list_to_binary(Password))>>},
+ Ssh)
+ end.
+
+user_interaction(Opts, IoCb) ->
+ case proplists:get_value(allow_user_interaction, Opts, true) of
+ true ->
+ IoCb:read_password("ssh password: ");
+ false ->
+ not_ok
+ end.
+
%% See RFC 4256 for info on keyboard-interactive
keyboard_interactive_msg([#ssh{user = User,
- service = Service} = Ssh]) ->
+ service = Service} = Ssh]) ->
ssh_bits:install_messages(userauth_keyboard_interactive_messages()),
ssh_transport:ssh_packet(
#ssh_msg_userauth_request{user = User,
service = Service,
method = "keyboard-interactive",
data = << ?STRING(<<"">>),
- ?STRING(<<>>) >> },
+ ?STRING(<<>>) >> },
Ssh).
service_request_msg(Ssh) ->