aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2012-10-24 15:23:25 +0200
committerFredrik Gustafsson <[email protected]>2012-11-05 15:43:14 +0100
commit689b5085d2e9bb1a3fbae81a0e6af600f91a5424 (patch)
tree4164b0e071dab28b6ffa39fbed25e6b09198bd5a /lib/ssh
parentacdfec8baf27093b59cd25ffbc84e6165f9bb427 (diff)
downloadotp-689b5085d2e9bb1a3fbae81a0e6af600f91a5424.tar.gz
otp-689b5085d2e9bb1a3fbae81a0e6af600f91a5424.tar.bz2
otp-689b5085d2e9bb1a3fbae81a0e6af600f91a5424.zip
Removing the password after auth
Diffstat (limited to 'lib/ssh')
-rw-r--r--lib/ssh/src/ssh_connection_manager.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/ssh/src/ssh_connection_manager.erl b/lib/ssh/src/ssh_connection_manager.erl
index e53cd4f4f7..01452642b1 100644
--- a/lib/ssh/src/ssh_connection_manager.erl
+++ b/lib/ssh/src/ssh_connection_manager.erl
@@ -523,7 +523,7 @@ handle_info({same_user, _}, State) ->
handle_info(ssh_connected, #state{role = client, client = Pid}
= State) ->
Pid ! {self(), is_connected},
- {noreply, State#state{connected = true}};
+ {noreply, State#state{connected = true, opts = handle_password(State#state.opts)}};
handle_info(ssh_connected, #state{role = server} = State) ->
{noreply, State#state{connected = true}};
@@ -536,6 +536,14 @@ handle_info({'DOWN', _Ref, process, ChannelPid, _Reason}, State) ->
handle_info({'EXIT', _Sup, Reason}, State) ->
{stop, Reason, State}.
+handle_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))}
+ end.
%%--------------------------------------------------------------------
%% Function: terminate(Reason, State) -> void()
%% Description: This function is called by a gen_server when it is about to