summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/ssh-keygen.c
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2002-03-27 22:21:45 +0000
committermarkus <markus@openbsd.org>2002-03-27 22:21:45 +0000
commit852b36581c79e5f4d63b468139a0a0d16d14f627 (patch)
tree77f94567e8f9649c9acaa1bfb962907f9bf0ee7a /usr.bin/ssh/ssh-keygen.c
parentIndicate which keys translations are missing. (diff)
downloadwireguard-openbsd-852b36581c79e5f4d63b468139a0a0d16d14f627.tar.xz
wireguard-openbsd-852b36581c79e5f4d63b468139a0a0d16d14f627.zip
try to import keys with extra trailing === (seen with ssh.com < 2.0.12)
Diffstat (limited to 'usr.bin/ssh/ssh-keygen.c')
-rw-r--r--usr.bin/ssh/ssh-keygen.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c
index f2b73ade3a6..d021c165081 100644
--- a/usr.bin/ssh/ssh-keygen.c
+++ b/usr.bin/ssh/ssh-keygen.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-keygen.c,v 1.97 2002/03/25 17:34:27 markus Exp $");
+RCSID("$OpenBSD: ssh-keygen.c,v 1.98 2002/03/27 22:21:45 markus Exp $");
#include <openssl/evp.h>
#include <openssl/pem.h>
@@ -286,6 +286,7 @@ do_convert_from_ssh2(struct passwd *pw)
{
Key *k;
int blen;
+ u_int len;
char line[1024], *p;
u_char blob[8096];
char encoded[8096];
@@ -330,6 +331,12 @@ do_convert_from_ssh2(struct passwd *pw)
*p = '\0';
strlcat(encoded, line, sizeof(encoded));
}
+ len = strlen(encoded);
+ if (((len % 4) == 3) &&
+ (encoded[len-1] == '=') &&
+ (encoded[len-2] == '=') &&
+ (encoded[len-3] == '='))
+ encoded[len-3] = '\0';
blen = uudecode(encoded, blob, sizeof(blob));
if (blen < 0) {
fprintf(stderr, "uudecode failed.\n");