summaryrefslogtreecommitdiff
path: root/authfile.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-05-14 13:45:22 +1000
committerDamien Miller <djm@mindrot.org>2003-05-14 13:45:22 +1000
commitdb2747259c1a433a504085f733768d0d209eb50d (patch)
treedb6e017b80fd5b2981f6e57ccf443a6cf5130c4c /authfile.c
parent3155432cd97e4dd380f11222407be0299714ce4a (diff)
- markus@cvs.openbsd.org 2003/05/11 16:56:48
[authfile.c ssh-keygen.c] 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).
Diffstat (limited to 'authfile.c')
-rw-r--r--authfile.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/authfile.c b/authfile.c
index 90618efde..d563abb71 100644
--- a/authfile.c
+++ b/authfile.c
@@ -36,7 +36,7 @@
36 */ 36 */
37 37
38#include "includes.h" 38#include "includes.h"
39RCSID("$OpenBSD: authfile.c,v 1.52 2003/03/13 11:42:18 markus Exp $"); 39RCSID("$OpenBSD: authfile.c,v 1.53 2003/05/11 16:56:48 markus Exp $");
40 40
41#include <openssl/err.h> 41#include <openssl/err.h>
42#include <openssl/evp.h> 42#include <openssl/evp.h>
@@ -629,9 +629,18 @@ key_load_public(const char *filename, char **commentp)
629 Key *pub; 629 Key *pub;
630 char file[MAXPATHLEN]; 630 char file[MAXPATHLEN];
631 631
632 /* try rsa1 private key */
632 pub = key_load_public_type(KEY_RSA1, filename, commentp); 633 pub = key_load_public_type(KEY_RSA1, filename, commentp);
633 if (pub != NULL) 634 if (pub != NULL)
634 return pub; 635 return pub;
636
637 /* try rsa1 public key */
638 pub = key_new(KEY_RSA1);
639 if (key_try_load_public(pub, filename, commentp) == 1)
640 return pub;
641 key_free(pub);
642
643 /* try ssh2 public key */
635 pub = key_new(KEY_UNSPEC); 644 pub = key_new(KEY_UNSPEC);
636 if (key_try_load_public(pub, filename, commentp) == 1) 645 if (key_try_load_public(pub, filename, commentp) == 1)
637 return pub; 646 return pub;