diff options
author | Darren Tucker <dtucker@zip.com.au> | 2010-01-12 19:41:22 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2010-01-12 19:41:22 +1100 |
commit | d4c86b13254d7c84b27b7cb8d32dcc7036ca3788 (patch) | |
tree | b43f895184faf976e8bd41d889ae7f5c93eedb45 | |
parent | 7ad8dd21da5e2a2687fdff14142b70f1587f96ce (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@
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | authfile.c | 14 | ||||
-rw-r--r-- | sshconnect2.c | 4 |
3 files changed, 18 insertions, 5 deletions
@@ -6,6 +6,11 @@ | |||
6 | single port forward on the server. This allows, for example, using ssh as | 6 | single port forward on the server. This allows, for example, using ssh as |
7 | a ProxyCommand to route connections via intermediate servers. | 7 | a ProxyCommand to route connections via intermediate servers. |
8 | bz #1618, man page help from jmc@, ok markus@ | 8 | bz #1618, man page help from jmc@, ok markus@ |
9 | - dtucker@cvs.openbsd.org 2010/01/11 04:46:45 | ||
10 | [authfile.c sshconnect2.c] | ||
11 | Do not prompt for a passphrase if we fail to open a keyfile, and log the | ||
12 | reason the open failed to debug. | ||
13 | bz #1693, found by tj AT castaglia org, ok djm@ | ||
9 | 14 | ||
10 | 20100110 | 15 | 20100110 |
11 | - (dtucker) [configure.ac misc.c readconf.c servconf.c ssh-keyscan.c] | 16 | - (dtucker) [configure.ac misc.c readconf.c servconf.c ssh-keyscan.c] |
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); |
diff --git a/sshconnect2.c b/sshconnect2.c index 367f0fc6c..ed40a9d70 100644 --- a/sshconnect2.c +++ b/sshconnect2.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect2.c,v 1.177 2010/01/04 01:45:30 dtucker Exp $ */ | 1 | /* $OpenBSD: sshconnect2.c,v 1.178 2010/01/11 04:46:45 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2008 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2008 Damien Miller. All rights reserved. |
@@ -1250,7 +1250,7 @@ load_identity_file(char *filename) | |||
1250 | { | 1250 | { |
1251 | Key *private; | 1251 | Key *private; |
1252 | char prompt[300], *passphrase; | 1252 | char prompt[300], *passphrase; |
1253 | int perm_ok, quit, i; | 1253 | int perm_ok = 0, quit, i; |
1254 | struct stat st; | 1254 | struct stat st; |
1255 | 1255 | ||
1256 | if (stat(filename, &st) < 0) { | 1256 | if (stat(filename, &st) < 0) { |