aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2015-08-05 13:10:14 +0200
committerHans Nilsson <[email protected]>2015-08-05 13:59:27 +0200
commit99825046c9e17510d5e627f9d2cb61b5e5eb7110 (patch)
tree8279705d80b2aaf72a3b5d74e00357b91be378e3 /lib/ssh/src/ssh.erl
parent3e8d8f4595182d0e695cc166d5c6cf4490d17e75 (diff)
downloadotp-99825046c9e17510d5e627f9d2cb61b5e5eb7110.tar.gz
otp-99825046c9e17510d5e627f9d2cb61b5e5eb7110.tar.bz2
otp-99825046c9e17510d5e627f9d2cb61b5e5eb7110.zip
ssh: more dh_gex test cases
Diffstat (limited to 'lib/ssh/src/ssh.erl')
-rw-r--r--lib/ssh/src/ssh.erl23
1 files changed, 9 insertions, 14 deletions
diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl
index cc2c591735..5b2e0a988c 100644
--- a/lib/ssh/src/ssh.erl
+++ b/lib/ssh/src/ssh.erl
@@ -418,29 +418,24 @@ handle_ssh_option({preferred_algorithms,[_|_]} = Opt) ->
handle_ssh_option({dh_gex_groups,L=[{I1,I2,I3}|_]}) when is_integer(I1), I1>0,
is_integer(I2), I2>0,
is_integer(I3), I3>0 ->
- {dh_gex_groups, [{N,{G,P}} || {N,P,G} <- L]};
+ {dh_gex_groups, lists:map(fun({N,G,P}) -> {N,{G,P}} end, L)};
handle_ssh_option({dh_gex_groups,{file,File=[C|_]}}=Opt) when is_integer(C), C>0 ->
%% A string, (file name)
case file:consult(File) of
{ok, List} ->
- case lists:all(fun({I1,I2,I3}) when is_integer(I1), I1>0,
- is_integer(I2), I2>0,
- is_integer(I3), I3>0 ->
- true;
- (_) ->
- false
- end, List) of
- true ->
- handle_ssh_option({dh_gex_groups,List});
- false ->
- throw({error, {{eoptions, Opt}, "Bad format in file "++File}})
+ try handle_ssh_option({dh_gex_groups,List}) of
+ {dh_gex_groups,_} = NewOpt ->
+ NewOpt
+ catch
+ _:_ ->
+ throw({error, {{eoptions, Opt}, "Bad format in file"}})
end;
Error ->
throw({error, {{eoptions, Opt},{"Error reading file",Error}}})
end;
handle_ssh_option({dh_gex_limits,{Min,I,Max}} = Opt) when is_integer(Min), Min>0,
- is_integer(I), I>0,
- is_integer(Max), Max>0 ->
+ is_integer(I), I>=Min,
+ is_integer(Max), Max>=I ->
Opt;
handle_ssh_option({connect_timeout, Value} = Opt) when is_integer(Value); Value == infinity ->
Opt;