From 155b981494967883796473c09cce5060fa26abbd Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Tue, 2 Apr 2002 20:26:26 +0000 Subject: - markus@cvs.openbsd.org 2002/03/27 22:21:45 [ssh-keygen.c] try to import keys with extra trailing === (seen with ssh.com < 2.0.12) --- ChangeLog | 6 +++++- ssh-keygen.c | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ca3bd9ff..ec5b98c8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ - deraadt@cvs.openbsd.org 2002/03/30 17:45:46 [scp.c] stretch banners + - (bal) OpenBSD CVS Sync (now for the real sync) + - markus@cvs.openbsd.org 2002/03/27 22:21:45 + [ssh-keygen.c] + try to import keys with extra trailing === (seen with ssh.com < 2.0.12) 20020401 - (stevesk) [monitor.c] PAM should work again; will *not* work with @@ -8110,4 +8114,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.2007 2002/04/02 20:17:43 mouring Exp $ +$Id: ChangeLog,v 1.2008 2002/04/02 20:26:26 mouring Exp $ diff --git a/ssh-keygen.c b/ssh-keygen.c index 1a8a73129..250e53e14 100644 --- a/ssh-keygen.c +++ b/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 #include @@ -290,6 +290,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]; @@ -334,6 +335,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"); -- cgit v1.2.3