Bugzilla – Attachment 1070 Details for
Bug 1157
ssh-keygen doesn't handle DOS line breaks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Make ssh-keygen accept CR, LF or CRLF in keys take 2.
openssh-keygen-newline.patch (text/plain), 1.34 KB, created by
Darren Tucker
on 2006-02-15 20:06:33 AEDT
(
hide
)
Description:
Make ssh-keygen accept CR, LF or CRLF in keys take 2.
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2006-02-15 20:06:33 AEDT
Size:
1.34 KB
patch
obsolete
>Index: ssh-keygen.c >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/ssh-keygen.c,v >retrieving revision 1.141 >diff -u -p -r1.141 ssh-keygen.c >--- ssh-keygen.c 29 Nov 2005 02:10:25 -0000 1.141 >+++ ssh-keygen.c 15 Feb 2006 09:01:41 -0000 >@@ -308,12 +308,13 @@ do_convert_from_ssh2(struct passwd *pw) > Key *k; > int blen; > u_int len; >- char line[1024], *p; >+ char line[1024], *p, *q; > u_char blob[8096]; > char encoded[8096]; > struct stat st; > int escaped = 0, private = 0, ok; > FILE *fp; >+ long position = 0; > > if (!have_identity) > ask_filename(pw, "Enter file in which the key is"); >@@ -328,9 +329,24 @@ do_convert_from_ssh2(struct passwd *pw) > } > encoded[0] = '\0'; > while (fgets(line, sizeof(line), fp)) { >- if (!(p = strchr(line, '\n'))) { >+ p = strchr(line, '\n'); >+ q = strchr(line, '\r'); >+ if (p == NULL && q == NULL) { > fprintf(stderr, "input line too long.\n"); > exit(1); >+ } else { >+ if (p == NULL) { >+ /* CR but no NL, seek to next line */ >+ p = q; >+ position += p - line + 1; >+ if (fseek(fp, position, SEEK_SET) != 0) { >+ fprintf(stderr, "fseek: %s\n", >+ strerror(errno)); >+ exit(1); >+ } >+ } else if (q != NULL) >+ /* have both, select first one */ >+ p = MIN(p, q); > } > if (p > line && p[-1] == '\\') > escaped++;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1157
:
1067
|
1068
|
1069
|
1070
|
1074
|
1078
|
1086
|
1087
|
1091