From 161ddec59071e77bf6fc49db9dd867aa0e0e1268 Mon Sep 17 00:00:00 2001 From: Fredrik Gustafsson Date: Thu, 25 Oct 2012 09:59:48 +0200 Subject: After auth rsa and dsa passwords is set to undefined --- lib/ssh/src/ssh_connection_manager.erl | 37 ++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'lib/ssh/src') diff --git a/lib/ssh/src/ssh_connection_manager.erl b/lib/ssh/src/ssh_connection_manager.erl index 01452642b1..16a31459e7 100644 --- a/lib/ssh/src/ssh_connection_manager.erl +++ b/lib/ssh/src/ssh_connection_manager.erl @@ -537,12 +537,45 @@ handle_info({'EXIT', _Sup, Reason}, State) -> {stop, Reason, State}. handle_password(Opts) -> + handle_rsa_password(handle_dsa_password(handle_normal_password(Opts))). +handle_normal_password(Opts) -> case proplists:get_value(ssh_opts, Opts, false) of false -> Opts; SshOpts -> - NewOpts = [{password, undefined}|lists:keydelete(password, 1, SshOpts)], - {ssh_opts, lists:merge(NewOpts, lists:keydelete(ssh_opts, 1, Opts))} + case proplists:get_value(password, SshOpts, false) of + false -> + Opts; + _Password -> + NewOpts = [{password, undefined}|lists:keydelete(password, 1, SshOpts)], + lists:merge(NewOpts, lists:keydelete(ssh_opts, 1, Opts)) + end + end. +handle_dsa_password(Opts) -> + case proplists:get_value(ssh_opts, Opts, false) of + false -> + Opts; + SshOpts -> + case proplists:get_value(dsa_pass_phrase, SshOpts, false) of + false -> + Opts; + _Password -> + NewOpts = [{dsa_pass_phase, undefined}|lists:keydelete(password, 1, SshOpts)], + lists:merge(NewOpts, lists:keydelete(ssh_opts, 1, Opts)) + end + end. +handle_rsa_password(Opts) -> + case proplists:get_value(ssh_opts, Opts, false) of + false -> + Opts; + SshOpts -> + case proplists:get_value(rsa_pass_phrase, SshOpts, false) of + false -> + Opts; + _Password -> + NewOpts = [{rsa_pass_phase, undefined}|lists:keydelete(password, 1, SshOpts)], + lists:merge(NewOpts, lists:keydelete(ssh_opts, 1, Opts)) + end end. %%-------------------------------------------------------------------- %% Function: terminate(Reason, State) -> void() -- cgit v1.2.3