summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/authfile.c
diff options
context:
space:
mode:
authordtucker <dtucker@openbsd.org>2010-01-11 04:46:45 +0000
committerdtucker <dtucker@openbsd.org>2010-01-11 04:46:45 +0000
commitc24f369c2cb67202ec9bec0af6e9ca9a399a6bbc (patch)
treeb8b0cfe52d668cbd9c603b9527be43f0f347e937 /usr.bin/ssh/authfile.c
parentWhen mapping CarBus memory BARs, enforce a minimum alignment of 0x1000. This (diff)
downloadwireguard-openbsd-c24f369c2cb67202ec9bec0af6e9ca9a399a6bbc.tar.xz
wireguard-openbsd-c24f369c2cb67202ec9bec0af6e9ca9a399a6bbc.zip
Do not prompt for a passphrase if we fail to open a keyfile, and log the
reason the open failed to debug. bz #1693, found by tj AT castaglia org, ok djm@
Diffstat (limited to 'usr.bin/ssh/authfile.c')
-rw-r--r--usr.bin/ssh/authfile.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/usr.bin/ssh/authfile.c b/usr.bin/ssh/authfile.c
index fd583de4096..5bed1730393 100644
--- a/usr.bin/ssh/authfile.c
+++ b/usr.bin/ssh/authfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authfile.c,v 1.77 2009/10/22 22:26:13 djm Exp $ */
+/* $OpenBSD: authfile.c,v 1.78 2010/01/11 04:46:45 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -547,7 +547,12 @@ key_load_private_type(int type, const char *filename, const char *passphrase,
int fd;
fd = open(filename, O_RDONLY);
- if (fd < 0)
+ if (fd < 0) {
+ debug("could not open key file '%s': %s", filename,
+ strerror(errno));
+ if (perm_ok != NULL)
+ *perm_ok = 0;
+ }
return NULL;
if (!key_perm_ok(fd, filename)) {
if (perm_ok != NULL)
@@ -583,8 +588,11 @@ key_load_private(const char *filename, const char *passphrase,
int fd;
fd = open(filename, O_RDONLY);
- if (fd < 0)
+ if (fd < 0) {
+ debug("could not open key file '%s': %s", filename,
+ strerror(errno));
return NULL;
+ }
if (!key_perm_ok(fd, filename)) {
error("bad permissions: ignore key: %s", filename);
close(fd);