authfile.c (1.77) | authfile.c (1.78) |
---|---|
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/* 3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 5 * All rights reserved 6 * This file contains functions for reading and writing identity files, and 7 * for reading the passphrase from the user. 8 * 9 * As far as I am concerned, the code I have written for this software --- 532 unchanged lines hidden (view full) --- 542 543Key * 544key_load_private_type(int type, const char *filename, const char *passphrase, 545 char **commentp, int *perm_ok) 546{ 547 int fd; 548 549 fd = open(filename, O_RDONLY); | 2/* 3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 5 * All rights reserved 6 * This file contains functions for reading and writing identity files, and 7 * for reading the passphrase from the user. 8 * 9 * As far as I am concerned, the code I have written for this software --- 532 unchanged lines hidden (view full) --- 542 543Key * 544key_load_private_type(int type, const char *filename, const char *passphrase, 545 char **commentp, int *perm_ok) 546{ 547 int fd; 548 549 fd = open(filename, O_RDONLY); |
550 if (fd < 0) | 550 if (fd < 0) { 551 debug("could not open key file '%s': %s", filename, 552 strerror(errno)); 553 if (perm_ok != NULL) 554 *perm_ok = 0; 555 } |
551 return NULL; 552 if (!key_perm_ok(fd, filename)) { 553 if (perm_ok != NULL) 554 *perm_ok = 0; 555 error("bad permissions: ignore key: %s", filename); 556 close(fd); 557 return NULL; 558 } --- 19 unchanged lines hidden (view full) --- 578Key * 579key_load_private(const char *filename, const char *passphrase, 580 char **commentp) 581{ 582 Key *pub, *prv; 583 int fd; 584 585 fd = open(filename, O_RDONLY); | 556 return NULL; 557 if (!key_perm_ok(fd, filename)) { 558 if (perm_ok != NULL) 559 *perm_ok = 0; 560 error("bad permissions: ignore key: %s", filename); 561 close(fd); 562 return NULL; 563 } --- 19 unchanged lines hidden (view full) --- 583Key * 584key_load_private(const char *filename, const char *passphrase, 585 char **commentp) 586{ 587 Key *pub, *prv; 588 int fd; 589 590 fd = open(filename, O_RDONLY); |
586 if (fd < 0) | 591 if (fd < 0) { 592 debug("could not open key file '%s': %s", filename, 593 strerror(errno)); |
587 return NULL; | 594 return NULL; |
595 } |
|
588 if (!key_perm_ok(fd, filename)) { 589 error("bad permissions: ignore key: %s", filename); 590 close(fd); 591 return NULL; 592 } 593 pub = key_load_public_rsa1(fd, filename, commentp); 594 lseek(fd, (off_t) 0, SEEK_SET); /* rewind */ 595 if (pub == NULL) { --- 79 unchanged lines hidden --- | 596 if (!key_perm_ok(fd, filename)) { 597 error("bad permissions: ignore key: %s", filename); 598 close(fd); 599 return NULL; 600 } 601 pub = key_load_public_rsa1(fd, filename, commentp); 602 lseek(fd, (off_t) 0, SEEK_SET); /* rewind */ 603 if (pub == NULL) { --- 79 unchanged lines hidden --- |