summaryrefslogtreecommitdiff
path: root/authfile.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2020-06-18 23:33:38 +0000
committerDarren Tucker <dtucker@dtucker.net>2020-06-19 15:51:04 +1000
commitc514f3c0522855b4d548286eaa113e209051a6d2 (patch)
treeac763d6eee27fa99574af3a147940a3f5a04f9aa /authfile.c
parent7fafaeb5da365f4a408fec355dac04a774f27193 (diff)
upstream: avoid spurious "Unable to load host key" message when
sshd can load a private key but no public counterpart; with & ok markus@ OpenBSD-Commit-ID: 0713cbdf9aa1ff8ac7b1f78b09ac911af510f81b
Diffstat (limited to 'authfile.c')
-rw-r--r--authfile.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/authfile.c b/authfile.c
index 35ccf576c..946f50ca8 100644
--- a/authfile.c
+++ b/authfile.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfile.c,v 1.140 2020/04/17 07:15:11 djm Exp $ */ 1/* $OpenBSD: authfile.c,v 1.141 2020/06/18 23:33:38 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved.
4 * 4 *
@@ -263,7 +263,7 @@ int
263sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp) 263sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp)
264{ 264{
265 char *pubfile = NULL; 265 char *pubfile = NULL;
266 int r; 266 int r, oerrno;
267 267
268 if (keyp != NULL) 268 if (keyp != NULL)
269 *keyp = NULL; 269 *keyp = NULL;
@@ -283,8 +283,14 @@ sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp)
283 if ((r = sshkey_load_pubkey_from_private(filename, keyp)) == 0) 283 if ((r = sshkey_load_pubkey_from_private(filename, keyp)) == 0)
284 goto out; 284 goto out;
285 285
286 /* Pretend we couldn't find the key */
287 r = SSH_ERR_SYSTEM_ERROR;
288 errno = ENOENT;
289
286 out: 290 out:
291 oerrno = errno;
287 free(pubfile); 292 free(pubfile);
293 errno = oerrno;
288 return r; 294 return r;
289} 295}
290 296