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)
- 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 3fbe11b0e..23535fa07 100644
--- a/authfile.c
+++ b/authfile.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfile.c,v 1.77 2009/10/22 22:26:13 djm Exp $ */ 1/* $OpenBSD: authfile.c,v 1.78 2010/01/11 04:46:45 dtucker 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
@@ -559,7 +559,12 @@ key_load_private_type(int type, const char *filename, const char *passphrase,
559 int fd; 559 int fd;
560 560
561 fd = open(filename, O_RDONLY); 561 fd = open(filename, O_RDONLY);
562 if (fd < 0) 562 if (fd < 0) {
563 debug("could not open key file '%s': %s", filename,
564 strerror(errno));
565 if (perm_ok != NULL)
566 *perm_ok = 0;
567 }
563 return NULL; 568 return NULL;
564 if (!key_perm_ok(fd, filename)) { 569 if (!key_perm_ok(fd, filename)) {
565 if (perm_ok != NULL) 570 if (perm_ok != NULL)
@@ -595,8 +600,11 @@ key_load_private(const char *filename, const char *passphrase,
595 int fd; 600 int fd;
596 601
597 fd = open(filename, O_RDONLY); 602 fd = open(filename, O_RDONLY);
598 if (fd < 0) 603 if (fd < 0) {
604 debug("could not open key file '%s': %s", filename,
605 strerror(errno));
599 return NULL; 606 return NULL;
607 }
600 if (!key_perm_ok(fd, filename)) { 608 if (!key_perm_ok(fd, filename)) {
601 error("bad permissions: ignore key: %s", filename); 609 error("bad permissions: ignore key: %s", filename);
602 close(fd); 610 close(fd);