mirror of git://anongit.mindrot.org/openssh.git
- markus@cvs.openbsd.org 2001/05/28 10:08:55
[authfile.c] key_load_private: set comment to filename for PEM keys
This commit is contained in:
parent
3b89c5ef89
commit
322915d5e4
|
@ -59,6 +59,9 @@
|
||||||
- markus@cvs.openbsd.org 2001/05/28 08:04:39
|
- markus@cvs.openbsd.org 2001/05/28 08:04:39
|
||||||
[ssh.c]
|
[ssh.c]
|
||||||
fix usage()
|
fix usage()
|
||||||
|
- markus@cvs.openbsd.org 2001/05/28 10:08:55
|
||||||
|
[authfile.c]
|
||||||
|
key_load_private: set comment to filename for PEM keys
|
||||||
|
|
||||||
20010528
|
20010528
|
||||||
- (tim) [conifgure.in] add setvbuf test needed for sftp-int.c
|
- (tim) [conifgure.in] add setvbuf test needed for sftp-int.c
|
||||||
|
@ -5489,4 +5492,4 @@
|
||||||
- Wrote replacements for strlcpy and mkdtemp
|
- Wrote replacements for strlcpy and mkdtemp
|
||||||
- Released 1.0pre1
|
- Released 1.0pre1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.1240 2001/06/05 20:44:16 mouring Exp $
|
$Id: ChangeLog,v 1.1241 2001/06/05 20:46:32 mouring Exp $
|
||||||
|
|
13
authfile.c
13
authfile.c
|
@ -36,7 +36,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: authfile.c,v 1.33 2001/05/16 20:51:57 markus Exp $");
|
RCSID("$OpenBSD: authfile.c,v 1.34 2001/05/28 10:08:55 markus Exp $");
|
||||||
|
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
|
@ -543,7 +543,7 @@ Key *
|
||||||
key_load_private(const char *filename, const char *passphrase,
|
key_load_private(const char *filename, const char *passphrase,
|
||||||
char **commentp)
|
char **commentp)
|
||||||
{
|
{
|
||||||
Key *pub;
|
Key *pub, *prv;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
fd = open(filename, O_RDONLY);
|
fd = open(filename, O_RDONLY);
|
||||||
|
@ -558,14 +558,17 @@ key_load_private(const char *filename, const char *passphrase,
|
||||||
lseek(fd, (off_t) 0, SEEK_SET); /* rewind */
|
lseek(fd, (off_t) 0, SEEK_SET); /* rewind */
|
||||||
if (pub == NULL) {
|
if (pub == NULL) {
|
||||||
/* closes fd */
|
/* closes fd */
|
||||||
return key_load_private_pem(fd, KEY_UNSPEC, passphrase,
|
prv = key_load_private_pem(fd, KEY_UNSPEC, passphrase, NULL);
|
||||||
commentp);
|
/* use the filename as a comment for PEM */
|
||||||
|
if (commentp && prv)
|
||||||
|
commentp = xstrdup(filename);
|
||||||
} else {
|
} else {
|
||||||
/* it's a SSH v1 key if the public key part is readable */
|
/* it's a SSH v1 key if the public key part is readable */
|
||||||
key_free(pub);
|
key_free(pub);
|
||||||
/* closes fd */
|
/* closes fd */
|
||||||
return key_load_private_rsa1(fd, filename, passphrase, NULL);
|
prv = key_load_private_rsa1(fd, filename, passphrase, NULL);
|
||||||
}
|
}
|
||||||
|
return prv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in New Issue