diff options
author | djm@openbsd.org <djm@openbsd.org> | 2020-12-20 23:40:19 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2020-12-21 10:52:28 +1100 |
commit | 0f504f592d15d8047e466eb7453067a6880992a8 (patch) | |
tree | 1cfdadac010ce35c14daf78410e020dacaf97ace /sshconnect2.c | |
parent | 729b05f59ded35483acef90a6f88aa03eae33b29 (diff) |
upstream: plumb ssh_conn_info through to sshconnect.c; feedback/ok
markus@
OpenBSD-Commit-ID: e8d14a09cda3f1dc55df08f8a4889beff74e68b0
Diffstat (limited to 'sshconnect2.c')
-rw-r--r-- | sshconnect2.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sshconnect2.c b/sshconnect2.c index afbb8526..4460bca8 100644 --- a/sshconnect2.c +++ b/sshconnect2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshconnect2.c,v 1.337 2020/12/20 23:36:51 djm Exp $ */ +/* $OpenBSD: sshconnect2.c,v 1.338 2020/12/20 23:40:19 djm Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2008 Damien Miller. All rights reserved. @@ -92,13 +92,15 @@ extern Options options; u_char *session_id2 = NULL; u_int session_id2_len = 0; -char *xxx_host; -struct sockaddr *xxx_hostaddr; +static char *xxx_host; +static struct sockaddr *xxx_hostaddr; +static const struct ssh_conn_info *xxx_conn_info; static int verify_host_key_callback(struct sshkey *hostkey, struct ssh *ssh) { - if (verify_host_key(xxx_host, xxx_hostaddr, hostkey) == -1) + if (verify_host_key(xxx_host, xxx_hostaddr, hostkey, + xxx_conn_info) == -1) fatal("Host key verification failed."); return 0; } @@ -116,7 +118,8 @@ first_alg(const char *algs) } static char * -order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port) +order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port, + const struct ssh_conn_info *cinfo) { char *oavail = NULL, *avail = NULL, *first = NULL, *last = NULL; char *alg = NULL, *hostname = NULL, *ret = NULL, *best = NULL; @@ -208,7 +211,8 @@ order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port) } void -ssh_kex2(struct ssh *ssh, char *host, struct sockaddr *hostaddr, u_short port) +ssh_kex2(struct ssh *ssh, char *host, struct sockaddr *hostaddr, u_short port, + const struct ssh_conn_info *cinfo) { char *myproposal[PROPOSAL_MAX] = { KEX_CLIENT }; char *s, *all_key; @@ -216,6 +220,7 @@ ssh_kex2(struct ssh *ssh, char *host, struct sockaddr *hostaddr, u_short port) xxx_host = host; xxx_hostaddr = hostaddr; + xxx_conn_info = cinfo; /* * If the user has not specified HostkeyAlgorithms, or has only @@ -250,7 +255,7 @@ ssh_kex2(struct ssh *ssh, char *host, struct sockaddr *hostaddr, u_short port) /* Query known_hosts and prefer algorithms that appear there */ myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = compat_pkalg_proposal( - order_hostkeyalgs(host, hostaddr, port)); + order_hostkeyalgs(host, hostaddr, port, cinfo)); } else { /* Use specified HostkeyAlgorithms exactly */ myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = |