diff options
author | kris <kris@FreeBSD.org> | 2000-06-03 06:51:30 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2000-06-03 06:51:30 +0000 |
commit | e1e1f536513ded16af2c57b02bb321a8459808e3 (patch) | |
tree | 4817e29d32f1ef1a65dc64ae864e653f4d580799 /crypto/openssh | |
parent | 4dc8aa85ced77e9e02dea6939edd4d3564b5086e (diff) | |
download | FreeBSD-src-e1e1f536513ded16af2c57b02bb321a8459808e3.zip FreeBSD-src-e1e1f536513ded16af2c57b02bb321a8459808e3.tar.gz |
Import vendor fix: "fix key_read() for uuencoded keys w/o '='"
This bug caused OpenSSH not to recognise some of the DSA keys it
generated.
Submitted by: Christian Weisgerber <naddy@mips.inka.de>
Obtained from: OpenBSD
Diffstat (limited to 'crypto/openssh')
-rw-r--r-- | crypto/openssh/key.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/crypto/openssh/key.c b/crypto/openssh/key.c index ae355a3..d474f85 100644 --- a/crypto/openssh/key.c +++ b/crypto/openssh/key.c @@ -256,12 +256,14 @@ key_read(Key *ret, char **cpp) blob = xmalloc(len); n = uudecode(cp, blob, len); if (n < 0) { - error("uudecode %s failed", cp); + error("key_read: uudecode %s failed", cp); return 0; } k = dsa_key_from_blob(blob, n); - if (k == NULL) - return 0; + if (k == NULL) { + error("key_read: dsa_key_from_blob %s failed", cp); + return 0; + } xfree(blob); if (ret->dsa != NULL) DSA_free(ret->dsa); @@ -269,10 +271,12 @@ key_read(Key *ret, char **cpp) k->dsa = NULL; key_free(k); bits = BN_num_bits(ret->dsa->p); - cp = strchr(cp, '='); - if (cp == NULL) - return 0; - *cpp = cp + 1; + /* advance cp: skip whitespace and data */ + while (*cp == ' ' || *cp == '\t') + cp++; + while (*cp != '\0' && *cp != ' ' && *cp != '\t') + cp++; + *cpp = cp; break; default: fatal("key_read: bad key type: %d", ret->type); |