Skip to content

Commit 4e7caeb

Browse files
cryptomilknviennot
authored andcommitted
ssh-client: Use ssh_get_server_publickey() if possible
1 parent e25ab3c commit 4e7caeb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tmate-ssh-client.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,13 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)
282282
}
283283

284284
case SSH_AUTH_SERVER:
285+
#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0, 9, 0)
286+
if (ssh_get_server_publickey(session, &pubkey) < 0)
287+
tmate_fatal("ssh_get_server_publickey");
288+
#else
285289
if (ssh_get_publickey(session, &pubkey) < 0)
286290
tmate_fatal("ssh_get_publickey");
291+
#endif
287292

288293
if (ssh_get_publickey_hash(pubkey, SSH_PUBLICKEY_HASH_SHA256,
289294
&hash, &hash_len) < 0) {

0 commit comments

Comments
 (0)