summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2020-06-18 23:33:38 +0000
committerdjm <djm@openbsd.org>2020-06-18 23:33:38 +0000
commit158bd5dc48087009b1905a0a571eddc22a3190dd (patch)
treeb435adfb03988dcf2db9a9b2cd2601c1044c524b
parentpass the mbuf with the data separately to the one with the pkthdr to mtap. (diff)
downloadwireguard-openbsd-158bd5dc48087009b1905a0a571eddc22a3190dd.tar.xz
wireguard-openbsd-158bd5dc48087009b1905a0a571eddc22a3190dd.zip
avoid spurious "Unable to load host key" message when sshd can load a
private key but no public counterpart; with & ok markus@
-rw-r--r--usr.bin/ssh/authfile.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/ssh/authfile.c b/usr.bin/ssh/authfile.c
index a14650777b1..484edd5705f 100644
--- a/usr.bin/ssh/authfile.c
+++ b/usr.bin/ssh/authfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authfile.c,v 1.140 2020/04/17 07:15:11 djm Exp $ */
+/* $OpenBSD: authfile.c,v 1.141 2020/06/18 23:33:38 djm Exp $ */
/*
* Copyright (c) 2000, 2013 Markus Friedl. All rights reserved.
*
@@ -258,7 +258,7 @@ int
sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp)
{
char *pubfile = NULL;
- int r;
+ int r, oerrno;
if (keyp != NULL)
*keyp = NULL;
@@ -278,8 +278,14 @@ sshkey_load_public(const char *filename, struct sshkey **keyp, char **commentp)
if ((r = sshkey_load_pubkey_from_private(filename, keyp)) == 0)
goto out;
+ /* Pretend we couldn't find the key */
+ r = SSH_ERR_SYSTEM_ERROR;
+ errno = ENOENT;
+
out:
+ oerrno = errno;
free(pubfile);
+ errno = oerrno;
return r;
}