summaryrefslogtreecommitdiff
path: root/authfile.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2006-05-06 17:41:51 +1000
committerDarren Tucker <dtucker@zip.com.au>2006-05-06 17:41:51 +1000
commit232b76f9f8b883db9ff7e7a3a9942ad7a28119e0 (patch)
treed7570bab5a189d98e81a837116c32197eae94774 /authfile.c
parentd8093e49bf06813a8c97cbc90810f4863388af77 (diff)
- dtucker@cvs.openbsd.org 2006/04/25 08:02:27
[authfile.c authfile.h sshconnect2.c ssh.c sshconnect1.c] Prevent ssh from trying to open private keys with bad permissions more than once or prompting for their passphrases (which it subsequently ignores anyway), similar to a previous change in ssh-add. bz #1186, ok djm@
Diffstat (limited to 'authfile.c')
-rw-r--r--authfile.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/authfile.c b/authfile.c
index b95b9470b..b1a28528f 100644
--- a/authfile.c
+++ b/authfile.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfile.c,v 1.66 2006/03/25 13:17:01 djm Exp $ */ 1/* $OpenBSD: authfile.c,v 1.67 2006/04/25 08:02:27 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
@@ -538,7 +538,7 @@ key_perm_ok(int fd, const char *filename)
538 538
539Key * 539Key *
540key_load_private_type(int type, const char *filename, const char *passphrase, 540key_load_private_type(int type, const char *filename, const char *passphrase,
541 char **commentp) 541 char **commentp, int *perm_ok)
542{ 542{
543 int fd; 543 int fd;
544 544
@@ -546,10 +546,14 @@ key_load_private_type(int type, const char *filename, const char *passphrase,
546 if (fd < 0) 546 if (fd < 0)
547 return NULL; 547 return NULL;
548 if (!key_perm_ok(fd, filename)) { 548 if (!key_perm_ok(fd, filename)) {
549 if (perm_ok != NULL)
550 *perm_ok = 0;
549 error("bad permissions: ignore key: %s", filename); 551 error("bad permissions: ignore key: %s", filename);
550 close(fd); 552 close(fd);
551 return NULL; 553 return NULL;
552 } 554 }
555 if (perm_ok != NULL)
556 *perm_ok = 1;
553 switch (type) { 557 switch (type) {
554 case KEY_RSA1: 558 case KEY_RSA1:
555 return key_load_private_rsa1(fd, filename, passphrase, 559 return key_load_private_rsa1(fd, filename, passphrase,