diff options
author | Ingela Anderton Andin <[email protected]> | 2012-08-30 09:38:13 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2012-08-30 09:38:13 +0200 |
commit | 9f69634d0ca0a21b0c8bc9ad1ab4d836db652170 (patch) | |
tree | ddb8ed247bf9778e9d30a73175139caa434035a1 /lib/ssh/src/ssh_file.erl | |
parent | 44b5b4f81398a0d0f2fc190fd5a77be3c594c6a8 (diff) | |
parent | 94f6c68ff4a46c69be0030aff553d6db92f29a35 (diff) | |
download | otp-9f69634d0ca0a21b0c8bc9ad1ab4d836db652170.tar.gz otp-9f69634d0ca0a21b0c8bc9ad1ab4d836db652170.tar.bz2 otp-9f69634d0ca0a21b0c8bc9ad1ab4d836db652170.zip |
Merge remote branch 'upstream/maint'
* upstream/maint:
ssh: Increase robustness
inets: Dialyzer spec fixes
Diffstat (limited to 'lib/ssh/src/ssh_file.erl')
-rw-r--r-- | lib/ssh/src/ssh_file.erl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_file.erl b/lib/ssh/src/ssh_file.erl index d05fa8e09a..a6b82a7a13 100644 --- a/lib/ssh/src/ssh_file.erl +++ b/lib/ssh/src/ssh_file.erl @@ -232,7 +232,7 @@ lookup_host_key_fd(Fd, Host, KeyType) -> eof -> {error, not_found}; Line -> - case public_key:ssh_decode(Line, known_hosts) of + case ssh_decode_line(Line, known_hosts) of [{Key, Attributes}] -> handle_host(Fd, Host, proplists:get_value(hostnames, Attributes), Key, KeyType); [] -> @@ -240,6 +240,13 @@ lookup_host_key_fd(Fd, Host, KeyType) -> end end. +ssh_decode_line(Line, Type) -> + try + public_key:ssh_decode(Line, Type) + catch _:_ -> + [] + end. + handle_host(Fd, Host, HostList, Key, KeyType) -> Host1 = host_name(Host), case lists:member(Host1, HostList) and key_match(Key, KeyType) of @@ -285,7 +292,7 @@ lookup_user_key_fd(Fd, Key) -> eof -> {error, not_found}; Line -> - case public_key:ssh_decode(Line, auth_keys) of + case ssh_decode_line(Line, auth_keys) of [{AuthKey, _}] -> case is_auth_key(Key, AuthKey) of true -> |