diff options
author | Hans Nilsson <[email protected]> | 2018-02-21 14:48:33 +0100 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2018-02-21 14:48:58 +0100 |
commit | ed01a9d3f2614933d05e7d85b4bb3568c4e04cdb (patch) | |
tree | b294c9d456844212c546c977cb691ae09d72a785 /lib/ssh/src/ssh_transport.erl | |
parent | 309ef748ddc5bde4bcba280ce2739385f27a76e6 (diff) | |
download | otp-ed01a9d3f2614933d05e7d85b4bb3568c4e04cdb.tar.gz otp-ed01a9d3f2614933d05e7d85b4bb3568c4e04cdb.tar.bz2 otp-ed01a9d3f2614933d05e7d85b4bb3568c4e04cdb.zip |
ssh: Add option save_accepted_host
Diffstat (limited to 'lib/ssh/src/ssh_transport.erl')
-rw-r--r-- | lib/ssh/src/ssh_transport.erl | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ssh/src/ssh_transport.erl b/lib/ssh/src/ssh_transport.erl index 154894cda8..a7f4854b4b 100644 --- a/lib/ssh/src/ssh_transport.erl +++ b/lib/ssh/src/ssh_transport.erl @@ -889,10 +889,13 @@ known_host_key(#ssh{opts = Opts, key_cb = {KeyCb,KeyCbOpts}, peer = {PeerName,_} {_,true} -> ok; {_,false} -> + DoAdd = ?GET_OPT(save_accepted_host, Opts), case accepted_host(Ssh, PeerName, Public, Opts) of - true -> + true when DoAdd == true -> {_,R} = add_host_key(KeyCb, PeerName, Public, [{key_cb_private,KeyCbOpts}|UserOpts]), R; + true when DoAdd == false -> + ok; false -> {error, rejected_by_user}; {error,E} -> |