summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2019-07-30 15:37:35 +0200
committerNicolas Viennot <nicolas@viennot.biz>2019-07-30 09:57:28 -0400
commit4e7caeb536629fc4ddc4d413ca867f754b1257c3 (patch)
tree6ff0774b2a477e4ce53bbbde67bd8ae971cd8c44
parente25ab3cc8bb4d42b137625b376d677707bc4fbe2 (diff)
ssh-client: Use ssh_get_server_publickey() if possible
-rw-r--r--tmate-ssh-client.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tmate-ssh-client.c b/tmate-ssh-client.c
index 943ebf49..c5fb4243 100644
--- a/tmate-ssh-client.c
+++ b/tmate-ssh-client.c
@@ -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) {