Skip to content

Commit

Permalink
ssh-client: Use ssh_get_server_publickey() if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptomilk authored and nviennot committed Jul 30, 2019
1 parent e25ab3c commit 4e7caeb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tmate-ssh-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,13 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)
}

case SSH_AUTH_SERVER:
#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0, 9, 0)
if (ssh_get_server_publickey(session, &pubkey) < 0)
tmate_fatal("ssh_get_server_publickey");
#else
if (ssh_get_publickey(session, &pubkey) < 0)
tmate_fatal("ssh_get_publickey");
#endif

if (ssh_get_publickey_hash(pubkey, SSH_PUBLICKEY_HASH_SHA256,
&hash, &hash_len) < 0) {
Expand Down

0 comments on commit 4e7caeb

Please sign in to comment.