diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-06-05 20:46:32 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-06-05 20:46:32 +0000 |
commit | 322915d5e4786ab60dd94766d602ddb8c0e31168 (patch) | |
tree | 84c0ae6bc37a060d7c65d96377c29def96b892ef | |
parent | 3b89c5ef8988ae33621efef8bd117db8f1f47e35 (diff) |
- markus@cvs.openbsd.org 2001/05/28 10:08:55
[authfile.c]
key_load_private: set comment to filename for PEM keys
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | authfile.c | 13 |
2 files changed, 12 insertions, 6 deletions
@@ -59,6 +59,9 @@ | |||
59 | - markus@cvs.openbsd.org 2001/05/28 08:04:39 | 59 | - markus@cvs.openbsd.org 2001/05/28 08:04:39 |
60 | [ssh.c] | 60 | [ssh.c] |
61 | fix usage() | 61 | fix usage() |
62 | - markus@cvs.openbsd.org 2001/05/28 10:08:55 | ||
63 | [authfile.c] | ||
64 | key_load_private: set comment to filename for PEM keys | ||
62 | 65 | ||
63 | 20010528 | 66 | 20010528 |
64 | - (tim) [conifgure.in] add setvbuf test needed for sftp-int.c | 67 | - (tim) [conifgure.in] add setvbuf test needed for sftp-int.c |
@@ -5489,4 +5492,4 @@ | |||
5489 | - Wrote replacements for strlcpy and mkdtemp | 5492 | - Wrote replacements for strlcpy and mkdtemp |
5490 | - Released 1.0pre1 | 5493 | - Released 1.0pre1 |
5491 | 5494 | ||
5492 | $Id: ChangeLog,v 1.1240 2001/06/05 20:44:16 mouring Exp $ | 5495 | $Id: ChangeLog,v 1.1241 2001/06/05 20:46:32 mouring Exp $ |
diff --git a/authfile.c b/authfile.c index 2715bdef8..e1a9a21a1 100644 --- a/authfile.c +++ b/authfile.c | |||
@@ -36,7 +36,7 @@ | |||
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include "includes.h" | 38 | #include "includes.h" |
39 | RCSID("$OpenBSD: authfile.c,v 1.33 2001/05/16 20:51:57 markus Exp $"); | 39 | RCSID("$OpenBSD: authfile.c,v 1.34 2001/05/28 10:08:55 markus Exp $"); |
40 | 40 | ||
41 | #include <openssl/err.h> | 41 | #include <openssl/err.h> |
42 | #include <openssl/evp.h> | 42 | #include <openssl/evp.h> |
@@ -543,7 +543,7 @@ Key * | |||
543 | key_load_private(const char *filename, const char *passphrase, | 543 | key_load_private(const char *filename, const char *passphrase, |
544 | char **commentp) | 544 | char **commentp) |
545 | { | 545 | { |
546 | Key *pub; | 546 | Key *pub, *prv; |
547 | int fd; | 547 | int fd; |
548 | 548 | ||
549 | fd = open(filename, O_RDONLY); | 549 | fd = open(filename, O_RDONLY); |
@@ -558,14 +558,17 @@ key_load_private(const char *filename, const char *passphrase, | |||
558 | lseek(fd, (off_t) 0, SEEK_SET); /* rewind */ | 558 | lseek(fd, (off_t) 0, SEEK_SET); /* rewind */ |
559 | if (pub == NULL) { | 559 | if (pub == NULL) { |
560 | /* closes fd */ | 560 | /* closes fd */ |
561 | return key_load_private_pem(fd, KEY_UNSPEC, passphrase, | 561 | prv = key_load_private_pem(fd, KEY_UNSPEC, passphrase, NULL); |
562 | commentp); | 562 | /* use the filename as a comment for PEM */ |
563 | if (commentp && prv) | ||
564 | commentp = xstrdup(filename); | ||
563 | } else { | 565 | } else { |
564 | /* it's a SSH v1 key if the public key part is readable */ | 566 | /* it's a SSH v1 key if the public key part is readable */ |
565 | key_free(pub); | 567 | key_free(pub); |
566 | /* closes fd */ | 568 | /* closes fd */ |
567 | return key_load_private_rsa1(fd, filename, passphrase, NULL); | 569 | prv = key_load_private_rsa1(fd, filename, passphrase, NULL); |
568 | } | 570 | } |
571 | return prv; | ||
569 | } | 572 | } |
570 | 573 | ||
571 | int | 574 | int |