summaryrefslogtreecommitdiff
path: root/authfile.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2010-01-12 19:41:22 +1100
committerDarren Tucker <dtucker@zip.com.au>2010-01-12 19:41:22 +1100
commitd4c86b13254d7c84b27b7cb8d32dcc7036ca3788 (patch)
treeb43f895184faf976e8bd41d889ae7f5c93eedb45 /authfile.c
parent7ad8dd21da5e2a2687fdff14142b70f1587f96ce (diff)
downloadopenssh-git-d4c86b13254d7c84b27b7cb8d32dcc7036ca3788.tar.gz
- dtucker@cvs.openbsd.org 2010/01/11 04:46:45
[authfile.c sshconnect2.c] 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 'authfile.c')
-rw-r--r--authfile.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/authfile.c b/authfile.c
index 3fbe11b0..23535fa0 100644
--- a/authfile.c
+++ b/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
@@ -559,7 +559,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)
@@ -595,8 +600,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);