mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-07 10:40:28 +09:00
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>
(cherry picked from commit c1a8c41c5d)
This commit is contained in:
committed by
Andreas Schneider
parent
17a6c3f88f
commit
4a4ca44b19
@@ -626,7 +626,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;
|
||||
@@ -646,8 +646,6 @@ static char *ssh_client_select_hostkeys(ssh_session session)
|
||||
needcomma = 1;
|
||||
}
|
||||
}
|
||||
|
||||
ssh_list_remove(algo_list, it);
|
||||
}
|
||||
}
|
||||
ssh_list_free(algo_list);
|
||||
|
||||
Reference in New Issue
Block a user