diff options
author | 2000-05-08 18:23:07 +0000 | |
---|---|---|
committer | 2000-05-08 18:23:07 +0000 | |
commit | 0c29aeef1287ca72a2dea96d061d4f088d898fb5 (patch) | |
tree | a666c2b6e6cd321a6652ec7ba28d56c6b86200b0 | |
parent | no drain if ibuf_empty, fixes x11fwd problems; tests by fries@ (diff) | |
download | wireguard-openbsd-0c29aeef1287ca72a2dea96d061d4f088d898fb5.tar.xz wireguard-openbsd-0c29aeef1287ca72a2dea96d061d4f088d898fb5.zip |
handle escapes in real and original key format, ok millert@
-rw-r--r-- | usr.bin/ssh/ssh-keygen.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c index a7a73873cbd..9129c70a8ec 100644 --- a/usr.bin/ssh/ssh-keygen.c +++ b/usr.bin/ssh/ssh-keygen.c @@ -7,7 +7,7 @@ */ #include "includes.h" -RCSID("$Id: ssh-keygen.c,v 1.24 2000/05/03 02:52:56 deraadt Exp $"); +RCSID("$Id: ssh-keygen.c,v 1.25 2000/05/08 18:23:07 markus Exp $"); #include <openssl/evp.h> #include <openssl/pem.h> @@ -144,6 +144,7 @@ do_convert_from_ssh2(struct passwd *pw) char blob[8096]; char encoded[8096]; struct stat st; + int escaped = 0; FILE *fp; if (!have_identity) @@ -159,14 +160,21 @@ do_convert_from_ssh2(struct passwd *pw) } encoded[0] = '\0'; while (fgets(line, sizeof(line), fp)) { + if (!(p = strchr(line, '\n'))) { + fprintf(stderr, "input line too long.\n"); + exit(1); + } + if (p > line && p[-1] == '\\') + escaped++; if (strncmp(line, "----", 4) == 0 || strstr(line, ": ") != NULL) { fprintf(stderr, "ignore: %s", line); continue; } - if (!(p = strchr(line, '\n'))) { - fprintf(stderr, "input line too long.\n"); - exit(1); + if (escaped) { + escaped--; + fprintf(stderr, "escaped: %s", line); + continue; } *p = '\0'; strlcat(encoded, line, sizeof(encoded)); |