summaryrefslogtreecommitdiffstats
path: root/authfile.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-05-14 05:45:22 +0200
committerDamien Miller <djm@mindrot.org>2003-05-14 05:45:22 +0200
commitdb2747259c1a433a504085f733768d0d209eb50d (patch)
treedb6e017b80fd5b2981f6e57ccf443a6cf5130c4c /authfile.c
parent - david@cvs.openbsd.org 2003/04/30 20:41:07 (diff)
downloadopenssh-db2747259c1a433a504085f733768d0d209eb50d.tar.xz
openssh-db2747259c1a433a504085f733768d0d209eb50d.zip
- 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 @@
*/
#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>
@@ -629,9 +629,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;