markus@openbsd, for PR 20550
>change key_load_public to try to read a public from: >rsa1 private or rsa1 public and ssh2 keys. >this makes ssh-keygen -e fail for ssh1 keys more gracefully >for example; report from itojun (netbsd pr 20550).
This commit is contained in:
parent
5e9a67bb93
commit
d6fa2807d4
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: authfile.c,v 1.15 2003/04/03 06:21:32 itojun Exp $ */
|
||||
/* $NetBSD: authfile.c,v 1.16 2003/05/14 18:17:02 itojun Exp $ */
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: authfile.c,v 1.52 2003/03/13 11:42:18 markus Exp $");
|
||||
RCSID("$OpenBSD: authfile.c,v 1.53 2003/05/11 16:56:48 markus Exp $");
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/evp.h>
|
||||
|
@ -627,9 +627,18 @@ key_load_public(const char *filename, char **commentp)
|
|||
Key *pub;
|
||||
char file[MAXPATHLEN];
|
||||
|
||||
/* try rsa1 private key */
|
||||
pub = key_load_public_type(KEY_RSA1, filename, commentp);
|
||||
if (pub != NULL)
|
||||
return pub;
|
||||
|
||||
/* try rsa1 public key */
|
||||
pub = key_new(KEY_RSA1);
|
||||
if (key_try_load_public(pub, filename, commentp) == 1)
|
||||
return pub;
|
||||
key_free(pub);
|
||||
|
||||
/* try ssh2 public key */
|
||||
pub = key_new(KEY_UNSPEC);
|
||||
if (key_try_load_public(pub, filename, commentp) == 1)
|
||||
return pub;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ssh-keygen.c,v 1.19 2003/04/03 06:21:35 itojun Exp $ */
|
||||
/* $NetBSD: ssh-keygen.c,v 1.20 2003/05/14 18:17:02 itojun Exp $ */
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||
|
@ -13,7 +13,7 @@
|
|||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: ssh-keygen.c,v 1.102 2002/11/26 00:45:03 wcobb Exp $");
|
||||
RCSID("$OpenBSD: ssh-keygen.c,v 1.104 2003/05/11 16:56:48 markus Exp $");
|
||||
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/pem.h>
|
||||
|
@ -160,6 +160,10 @@ do_convert_to_ssh2(struct passwd *pw)
|
|||
exit(1);
|
||||
}
|
||||
}
|
||||
if (k->type == KEY_RSA1) {
|
||||
fprintf(stderr, "version 1 keys are not supported\n");
|
||||
exit(1);
|
||||
}
|
||||
if (key_to_blob(k, &blob, &len) <= 0) {
|
||||
fprintf(stderr, "key_to_blob failed\n");
|
||||
exit(1);
|
||||
|
|
Loading…
Reference in New Issue