diff options
author | Hans Nilsson <[email protected]> | 2018-05-09 11:42:49 +0200 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2018-05-09 12:10:21 +0200 |
commit | ebcece7f317f6d4e4d580c1f5629f4f46defe272 (patch) | |
tree | 63cfe60c2fee11f4f73a8b95bed4f849dadc72e7 /lib/ssh/src/ssh_options.erl | |
parent | 79e3c477f8d0d8ea397820847c576e0a0aaa5323 (diff) | |
download | otp-ebcece7f317f6d4e4d580c1f5629f4f46defe272.tar.gz otp-ebcece7f317f6d4e4d580c1f5629f4f46defe272.tar.bz2 otp-ebcece7f317f6d4e4d580c1f5629f4f46defe272.zip |
ssh: Add infinity as values to rekey_limit
Zero is removed from the Minutes in the new tuple value to remove a loop possibility. The zero is kept for bytes since that is not dangerous and a removal would be an unnecssary incompatibility.
Diffstat (limited to 'lib/ssh/src/ssh_options.erl')
-rw-r--r-- | lib/ssh/src/ssh_options.erl | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/ssh/src/ssh_options.erl b/lib/ssh/src/ssh_options.erl index 73287e464a..fe95d2ac54 100644 --- a/lib/ssh/src/ssh_options.erl +++ b/lib/ssh/src/ssh_options.erl @@ -601,14 +601,19 @@ default(common) -> {rekey_limit, def} => #{default => {3600000, 1024000000}, % {1 hour, 1 GB} - chk => fun({TimeMins, SizBytes}) when is_integer(TimeMins) andalso TimeMins>=0, - is_integer(SizBytes) andalso SizBytes>=0 -> - %% New (>= 21) format - {true, {TimeMins * 60*1000, % To ms - SizBytes}}; - (SizBytes) when is_integer(SizBytes) andalso SizBytes>=0 -> - %% Old (< 21) format - {true, {3600000, SizBytes}}; + chk => fun({infinity, infinity}) -> + true; + ({Mins, infinity}) when is_integer(Mins), Mins>0 -> + {true, {Mins*60*1000, infinity}}; + ({infinity, Bytes}) when is_integer(Bytes), Bytes>=0 -> + true; + ({Mins, Bytes}) when is_integer(Mins), Mins>0, + is_integer(Bytes), Bytes>=0 -> + {true, {Mins*60*1000, Bytes}}; + (infinity) -> + {true, {3600000, infinity}}; + (Bytes) when is_integer(Bytes), Bytes>=0 -> + {true, {3600000, Bytes}}; (_) -> false end, |