diff options
author | Erlang/OTP <[email protected]> | 2016-06-22 14:15:18 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2016-06-22 14:15:18 +0200 |
commit | c5e8ddfec9757e44513dceaac5a00e112bb4a4e4 (patch) | |
tree | 4d7416f210e1a54e7ef95ee3aa6c3181a333fe96 /lib/ssh/src/ssh_connection_handler.erl | |
parent | 53e7743216647d810d529e397bd3ea7278c6047c (diff) | |
parent | 76c968d9a0f667ea3e112676861f5dc399113dae (diff) | |
download | otp-c5e8ddfec9757e44513dceaac5a00e112bb4a4e4.tar.gz otp-c5e8ddfec9757e44513dceaac5a00e112bb4a4e4.tar.bz2 otp-c5e8ddfec9757e44513dceaac5a00e112bb4a4e4.zip |
Merge branch 'hans/ssh/retry_pwd_patch/OTP-13674' into maint-18
* hans/ssh/retry_pwd_patch/OTP-13674:
ssh: update vsn.mk
ssh: polishing of password prompt's linefeed
ssh: Fix a hazard bug in ssh_auth
ssh: Some code cuddling in ssh_io
ssh: Fix type error in args of ssh_auth:sort_selected_mthds
ssh: Make client send a faulty pwd only once, ssh_connection_handler part
ssh: Make client send a faulty pwd only once, ssh_auth part
ssh: test cases for no repetition of bad passwords
Diffstat (limited to 'lib/ssh/src/ssh_connection_handler.erl')
-rw-r--r-- | lib/ssh/src/ssh_connection_handler.erl | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl index ce1931e4f4..b73f8b23d2 100644 --- a/lib/ssh/src/ssh_connection_handler.erl +++ b/lib/ssh/src/ssh_connection_handler.erl @@ -612,11 +612,14 @@ userauth(#ssh_msg_userauth_banner{message = Msg}, userauth_keyboard_interactive(#ssh_msg_userauth_info_request{} = Msg, - #state{ssh_params = #ssh{role = client, - io_cb = IoCb} = Ssh0} = State) -> - {ok, {Reply, Ssh}} = ssh_auth:handle_userauth_info_request(Msg, IoCb, Ssh0), - send_msg(Reply, State), - {next_state, userauth_keyboard_interactive_info_response, next_packet(State#state{ssh_params = Ssh})}; + #state{ssh_params = #ssh{role = client} = Ssh0} = State) -> + case ssh_auth:handle_userauth_info_request(Msg, Ssh0) of + {ok, {Reply, Ssh}} -> + send_msg(Reply, State), + {next_state, userauth_keyboard_interactive_info_response, next_packet(State#state{ssh_params = Ssh})}; + not_ok -> + userauth(Msg, State) + end; userauth_keyboard_interactive(#ssh_msg_userauth_info_response{} = Msg, #state{ssh_params = #ssh{role = server, @@ -646,7 +649,18 @@ userauth_keyboard_interactive(Msg = #ssh_msg_userauth_failure{}, userauth_keyboard_interactive_info_response(Msg=#ssh_msg_userauth_failure{}, - #state{ssh_params = #ssh{role = client}} = State) -> + #state{ssh_params = #ssh{role = client, + opts = Opts} = Ssh0} = State0) -> + + State = case proplists:get_value(password, Opts) of + undefined -> + State0; + _ -> + State0#state{ssh_params = + Ssh0#ssh{opts = + lists:keyreplace(password,1,Opts, + {password,not_ok})}} + end, userauth(Msg, State); userauth_keyboard_interactive_info_response(Msg=#ssh_msg_userauth_success{}, #state{ssh_params = #ssh{role = client}} = State) -> @@ -1247,7 +1261,7 @@ init_ssh(client = Role, Vsn, Version, Options, Socket) -> end, AuthMethods = proplists:get_value(auth_methods, Options, - ?SUPPORTED_AUTH_METHODS), + undefined), {ok, PeerAddr} = inet:peername(Socket), PeerName = proplists:get_value(host, Options), |