diff options
author | Hans Nilsson <[email protected]> | 2017-02-16 17:52:49 +0100 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2017-02-16 17:52:49 +0100 |
commit | 66cda469630d5ce5b27493355b96c6d6e225f86b (patch) | |
tree | 7a04e5832d55e76a2ec5cf5f2c1f197789cedfa0 /lib/ssh/src | |
parent | 05ac1e94bf314e41b6f8747738584e233d2d944e (diff) | |
parent | 5fa9ae3f7cce55047061b94f35940d6eaf94d9ee (diff) | |
download | otp-66cda469630d5ce5b27493355b96c6d6e225f86b.tar.gz otp-66cda469630d5ce5b27493355b96c6d6e225f86b.tar.bz2 otp-66cda469630d5ce5b27493355b96c6d6e225f86b.zip |
Merge branch 'hans/public_key/ssh_fingerprint_algorithm_list/OTP-14223' into maint
Diffstat (limited to 'lib/ssh/src')
-rw-r--r-- | lib/ssh/src/ssh.erl | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl index 31e343e81b..f408086c0f 100644 --- a/lib/ssh/src/ssh.erl +++ b/lib/ssh/src/ssh.erl @@ -620,11 +620,22 @@ handle_ssh_option({silently_accept_hosts, Value} = Opt) when is_boolean(Value) - handle_ssh_option({silently_accept_hosts, Value} = Opt) when is_function(Value,2) -> Opt; handle_ssh_option({silently_accept_hosts, {DigestAlg,Value}} = Opt) when is_function(Value,2) -> - case lists:member(DigestAlg, [md5, sha, sha224, sha256, sha384, sha512]) of - true -> - Opt; - false -> - throw({error, {eoptions, Opt}}) + Algs = if is_atom(DigestAlg) -> [DigestAlg]; + is_list(DigestAlg) -> DigestAlg; + true -> throw({error, {eoptions, Opt}}) + end, + case [A || A <- Algs, + not lists:member(A, [md5, sha, sha224, sha256, sha384, sha512])] of + [_|_] = UnSup1 -> + throw({error, {{eoptions, Opt}, {not_fingerprint_algos,UnSup1}}}); + [] -> + CryptoHashAlgs = proplists:get_value(hashs, crypto:supports(), []), + case [A || A <- Algs, + not lists:member(A, CryptoHashAlgs)] of + [_|_] = UnSup2 -> + throw({error, {{eoptions, Opt}, {unsupported_algo,UnSup2}}}); + [] -> Opt + end end; handle_ssh_option({user_interaction, Value} = Opt) when is_boolean(Value) -> Opt; |