summaryrefslogtreecommitdiff
path: root/hostfile.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2020-05-13 09:52:41 +0000
committerDamien Miller <djm@mindrot.org>2020-05-27 10:09:18 +1000
commit05a651400da6fbe12296c34e3d3bcf09f034fbbf (patch)
tree6d32fe8e5a0d61d5016adae80c759734e8def3aa /hostfile.c
parent829451815ec207e14bd54ff5cf7e22046816f042 (diff)
upstream: when ordering the hostkey algorithms to request from a
server, prefer certificate types if the known_hosts files contain a key marked as a @cert-authority; bz#3157 ok markus@ OpenBSD-Commit-ID: 8f194573e5bb7c01b69bbfaabc68f27c9fa5e0db
Diffstat (limited to 'hostfile.c')
-rw-r--r--hostfile.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/hostfile.c b/hostfile.c
index a4a355972..a91dbbd94 100644
--- a/hostfile.c
+++ b/hostfile.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hostfile.c,v 1.79 2020/03/06 18:25:12 markus Exp $ */ 1/* $OpenBSD: hostfile.c,v 1.80 2020/05/13 09:52:41 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -406,6 +406,18 @@ lookup_key_in_hostkeys_by_type(struct hostkeys *hostkeys, int keytype,
406 found) == HOST_FOUND); 406 found) == HOST_FOUND);
407} 407}
408 408
409int
410lookup_marker_in_hostkeys(struct hostkeys *hostkeys, int want_marker)
411{
412 u_int i;
413
414 for (i = 0; i < hostkeys->num_entries; i++) {
415 if (hostkeys->entries[i].marker == (HostkeyMarker)want_marker)
416 return 1;
417 }
418 return 0;
419}
420
409static int 421static int
410write_host_entry(FILE *f, const char *host, const char *ip, 422write_host_entry(FILE *f, const char *host, const char *ip,
411 const struct sshkey *key, int store_hash) 423 const struct sshkey *key, int store_hash)