aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-08-31 17:53:45 +0200
committerHans Nilsson <[email protected]>2017-09-11 12:11:42 +0200
commitfdb4455125776076b72dc1e31f2909c5ea819651 (patch)
tree497b2f7ae48274e7329ce7476d67eefcc142526c /lib/ssh
parent4bdb8f52303ceecb5e7c00592b53aa8dcaa49ab9 (diff)
downloadotp-fdb4455125776076b72dc1e31f2909c5ea819651.tar.gz
otp-fdb4455125776076b72dc1e31f2909c5ea819651.tar.bz2
otp-fdb4455125776076b72dc1e31f2909c5ea819651.zip
ssh: ssh:chk_algos_opts/1
This function is intended primarily for users who want to experiment with the options preferred_algorithms and modify_algorithms.
Diffstat (limited to 'lib/ssh')
-rw-r--r--lib/ssh/src/ssh.erl22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl
index 5ebab43c30..1a5d48baca 100644
--- a/lib/ssh/src/ssh.erl
+++ b/lib/ssh/src/ssh.erl
@@ -35,6 +35,7 @@
daemon/1, daemon/2, daemon/3,
daemon_info/1,
default_algorithms/0,
+ chk_algos_opts/1,
stop_listener/1, stop_listener/2, stop_listener/3,
stop_daemon/1, stop_daemon/2, stop_daemon/3,
shell/1, shell/2, shell/3
@@ -381,6 +382,27 @@ default_algorithms() ->
ssh_transport:default_algorithms().
%%--------------------------------------------------------------------
+-spec chk_algos_opts(list(any())) -> algs_list() .
+%%--------------------------------------------------------------------
+chk_algos_opts(Opts) ->
+ case lists:foldl(
+ fun({preferred_algorithms,_}, Acc) -> Acc;
+ ({modify_algorithms,_}, Acc) -> Acc;
+ (KV, Acc) -> [KV|Acc]
+ end, [], Opts)
+ of
+ [] ->
+ case ssh_options:handle_options(client, Opts) of
+ M when is_map(M) ->
+ maps:get(preferred_algorithms, M);
+ Others ->
+ Others
+ end;
+ OtherOps ->
+ {error, {non_algo_opts_found,OtherOps}}
+ end.
+
+%%--------------------------------------------------------------------
%%% Internal functions
%%--------------------------------------------------------------------
%% The handle_daemon_args/2 function basically only sets the ip-option in Opts