aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh_transport.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2014-09-29 08:59:48 +0200
committerErlang/OTP <[email protected]>2014-09-29 08:59:48 +0200
commitee4af1e0736f0ae1661fecd63c05c24c4067e4ea (patch)
tree9b39aa16f506fa58022ea8f943cc7c01de0fa541 /lib/ssh/src/ssh_transport.erl
parent6f565f2e5db3afc29c1dea9f00bc2126e2758b9f (diff)
parent0fba2ec56dd3557a6ef74a211581dce9827be1a6 (diff)
downloadotp-ee4af1e0736f0ae1661fecd63c05c24c4067e4ea.tar.gz
otp-ee4af1e0736f0ae1661fecd63c05c24c4067e4ea.tar.bz2
otp-ee4af1e0736f0ae1661fecd63c05c24c4067e4ea.zip
Merge branch 'ia/ssh/version-handling-gracefull/OTP-12157' into maint-17
* ia/ssh/version-handling-gracefull/OTP-12157: ssh: Add format_status/2 so sensitive data will not be present in logs ssh: Gracefully handle incorrect versions
Diffstat (limited to 'lib/ssh/src/ssh_transport.erl')
-rw-r--r--lib/ssh/src/ssh_transport.erl27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/ssh/src/ssh_transport.erl b/lib/ssh/src/ssh_transport.erl
index ea05c849b7..76fa776113 100644
--- a/lib/ssh/src/ssh_transport.erl
+++ b/lib/ssh/src/ssh_transport.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2014. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -82,16 +82,21 @@ format_version({Major,Minor}) ->
integer_to_list(Minor) ++ "-Erlang".
handle_hello_version(Version) ->
- StrVersion = trim_tail(Version),
- case string:tokens(Version, "-") of
- [_, "2.0" | _] ->
- {{2,0}, StrVersion};
- [_, "1.99" | _] ->
- {{2,0}, StrVersion};
- [_, "1.3" | _] ->
- {{1,3}, StrVersion};
- [_, "1.5" | _] ->
- {{1,5}, StrVersion}
+ try
+ StrVersion = trim_tail(Version),
+ case string:tokens(Version, "-") of
+ [_, "2.0" | _] ->
+ {{2,0}, StrVersion};
+ [_, "1.99" | _] ->
+ {{2,0}, StrVersion};
+ [_, "1.3" | _] ->
+ {{1,3}, StrVersion};
+ [_, "1.5" | _] ->
+ {{1,5}, StrVersion}
+ end
+ catch
+ error:_ ->
+ {undefined, "unknown version"}
end.
key_exchange_init_msg(Ssh0) ->