diff options
author | djm@openbsd.org <djm@openbsd.org> | 2020-12-21 00:36:51 +0100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2020-12-21 00:52:28 +0100 |
commit | b4c7cd1185c5dc0593d47eafcc1a34fda569dd1d (patch) | |
tree | efcf7641caaa015124a7b5cfd6622a0791ed0c32 /sshconnect.c | |
parent | upstream: Print client kem key with correct length. (diff) | |
download | openssh-b4c7cd1185c5dc0593d47eafcc1a34fda569dd1d.tar.xz openssh-b4c7cd1185c5dc0593d47eafcc1a34fda569dd1d.zip |
upstream: load_hostkeys()/hostkeys_foreach() variants for FILE*
Add load_hostkeys_file() and hostkeys_foreach_file() that accept a
FILE* argument instead of opening the file directly.
Original load_hostkeys() and hostkeys_foreach() are implemented using
these new interfaces.
Add a u_int note field to the hostkey_entry and hostkey_foreach_line
structs that is passed directly from the load_hostkeys() and
hostkeys_foreach() call. This is a lightweight way to annotate results
between different invocations of load_hostkeys().
ok markus@
OpenBSD-Commit-ID: 6ff6db13ec9ee4edfa658b2c38baad0f505d8c20
Diffstat (limited to 'sshconnect.c')
-rw-r--r-- | sshconnect.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sshconnect.c b/sshconnect.c index 6b60ca0d3..592114166 100644 --- a/sshconnect.c +++ b/sshconnect.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshconnect.c,v 1.345 2020/11/27 00:49:58 djm Exp $ */ +/* $OpenBSD: sshconnect.c,v 1.346 2020/12/20 23:36:51 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -773,7 +773,7 @@ hostkeys_find_by_key_hostfile(const char *file, const char *which, debug3_f("trying %s hostfile \"%s\"", which, file); if ((r = hostkeys_foreach(file, hostkeys_find_by_key_cb, ctx, - ctx->host, ctx->ip, HKF_WANT_PARSE_KEY)) != 0) { + ctx->host, ctx->ip, HKF_WANT_PARSE_KEY, 0)) != 0) { if (r == SSH_ERR_SYSTEM_ERROR && errno == ENOENT) { debug_f("hostkeys file %s does not exist", file); return 0; @@ -924,17 +924,17 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, host_hostkeys = init_hostkeys(); for (i = 0; i < num_user_hostfiles; i++) - load_hostkeys(host_hostkeys, host, user_hostfiles[i]); + load_hostkeys(host_hostkeys, host, user_hostfiles[i], 0); for (i = 0; i < num_system_hostfiles; i++) - load_hostkeys(host_hostkeys, host, system_hostfiles[i]); + load_hostkeys(host_hostkeys, host, system_hostfiles[i], 0); ip_hostkeys = NULL; if (!want_cert && options.check_host_ip) { ip_hostkeys = init_hostkeys(); for (i = 0; i < num_user_hostfiles; i++) - load_hostkeys(ip_hostkeys, ip, user_hostfiles[i]); + load_hostkeys(ip_hostkeys, ip, user_hostfiles[i], 0); for (i = 0; i < num_system_hostfiles; i++) - load_hostkeys(ip_hostkeys, ip, system_hostfiles[i]); + load_hostkeys(ip_hostkeys, ip, system_hostfiles[i], 0); } retry: |