diff options
author | 2003-05-11 16:56:48 +0000 | |
---|---|---|
committer | 2003-05-11 16:56:48 +0000 | |
commit | d706417a069bc65413ace4330cbe48ecf1a0f840 (patch) | |
tree | 147ae99ccade9d6980c12086ef0658ccbf01ba5d /usr.bin/ssh/authfile.c | |
parent | Document \s (diff) | |
download | wireguard-openbsd-d706417a069bc65413ace4330cbe48ecf1a0f840.tar.xz wireguard-openbsd-d706417a069bc65413ace4330cbe48ecf1a0f840.zip |
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 'usr.bin/ssh/authfile.c')
-rw-r--r-- | usr.bin/ssh/authfile.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.bin/ssh/authfile.c b/usr.bin/ssh/authfile.c index 932cc2cf48e..944e88fa80e 100644 --- a/usr.bin/ssh/authfile.c +++ b/usr.bin/ssh/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> @@ -626,9 +626,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; |