diff options
author | Jakub Jelen <jjelen@redhat.com> | 2018-10-18 13:50:55 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-10-19 17:42:55 +0200 |
commit | c1a8c41c5daf79e37aa5fde67dd94c8596e81102 (patch) | |
tree | 869ac775333bd6d072663b338d3f98c46ad612aa /src | |
parent | 893b69d82b4435973ec4d15aaecdf352f5f827e2 (diff) | |
download | libssh-c1a8c41c5daf79e37aa5fde67dd94c8596e81102.tar.gz libssh-c1a8c41c5daf79e37aa5fde67dd94c8596e81102.tar.xz libssh-c1a8c41c5daf79e37aa5fde67dd94c8596e81102.zip |
kex: Honor more host key algorithms than the first one (ssh-ed25519)
The code as it was written used only the first algorithm from
preferred_hostkeys array and compared it with the list returned
from the known hosts.
This commit is fixing the code so we actually compare each of the
algorithms from both of the lists and returns the intersection.
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/kex.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -639,7 +639,7 @@ static char *ssh_client_select_hostkeys(ssh_session session) for (i = 0; preferred_hostkeys[i] != NULL; ++i) { for (it = ssh_list_get_iterator(algo_list); it != NULL; - it = ssh_list_get_iterator(algo_list)) { + it = it->next) { const char *algo = ssh_iterator_value(const char *, it); int cmp; int ok; @@ -659,8 +659,6 @@ static char *ssh_client_select_hostkeys(ssh_session session) needcomma = 1; } } - - ssh_list_remove(algo_list, it); } } ssh_list_free(algo_list); |