Bugzilla – Attachment 2103 Details for
Bug 1545
ssh-keygen -R removes all comments from known_hosts file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
bz1545.diff
bz1545.diff (text/plain), 3.43 KB, created by
Damien Miller
on 2011-11-04 11:34:06 AEDT
(
hide
)
Description:
bz1545.diff
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2011-11-04 11:34:06 AEDT
Size:
3.43 KB
patch
obsolete
>Index: ssh-keygen.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/ssh-keygen.c,v >retrieving revision 1.212 >diff -u -p -r1.212 ssh-keygen.c >--- ssh-keygen.c 16 Oct 2011 15:02:41 -0000 1.212 >+++ ssh-keygen.c 4 Nov 2011 00:33:21 -0000 >@@ -926,7 +926,8 @@ do_gen_all_hostkeys(struct passwd *pw) > } > > static void >-printhost(FILE *f, const char *name, Key *public, int ca, int hash) >+printhost(FILE *f, const char *name, const char *comment, Key *public, >+ int ca, int hash) > { > if (print_fingerprint) { > enum fp_rep rep; >@@ -949,6 +950,8 @@ printhost(FILE *f, const char *name, Key > fprintf(f, "%s%s%s ", ca ? CA_MARKER : "", ca ? " " : "", name); > if (!key_write(public, f)) > fatal("key_write failed"); >+ if (comment != NULL && *comment) >+ fprintf(f, " %s", comment); > fprintf(f, "\n"); > } > } >@@ -1052,7 +1055,6 @@ do_known_hosts(struct passwd *pw, const > continue; > } > } >- > if (*cp == HASH_DELIM) { > if (find_host || delete_host) { > cp2 = host_hash(name, cp, strlen(cp)); >@@ -1068,12 +1070,12 @@ do_known_hosts(struct passwd *pw, const > "line %d type %s%s\n", name, > num, key_type(pub), > ca ? " (CA key)" : ""); >- printhost(out, cp, pub, ca, 0); >+ printhost(out, cp, kp, pub, ca, 0); > } > if (delete_host && !c && !ca) >- printhost(out, cp, pub, ca, 0); >+ printhost(out, cp, kp, pub, ca, 0); > } else if (hash_hosts) >- printhost(out, cp, pub, ca, 0); >+ printhost(out, cp, kp, pub, ca, 0); > } else { > if (find_host || delete_host) { > c = (match_hostname(name, cp, >@@ -1083,11 +1085,11 @@ do_known_hosts(struct passwd *pw, const > "line %d type %s%s\n", name, > num, key_type(pub), > ca ? " (CA key)" : ""); >- printhost(out, name, pub, >+ printhost(out, name, kp, pub, > ca, hash_hosts && !ca); > } > if (delete_host && !c && !ca) >- printhost(out, cp, pub, ca, 0); >+ printhost(out, cp, kp, pub, ca, 0); > } else if (hash_hosts) { > for (cp2 = strsep(&cp, ","); > cp2 != NULL && *cp2 != '\0'; >@@ -1096,16 +1098,19 @@ do_known_hosts(struct passwd *pw, const > fprintf(stderr, "Warning: " > "ignoring CA key for host: " > "%.64s\n", cp2); >- printhost(out, cp2, pub, ca, 0); >+ printhost(out, cp2, kp, pub, >+ ca, 0); > } else if (strcspn(cp2, "*?!") != > strlen(cp2)) { > fprintf(stderr, "Warning: " > "ignoring host name with " > "metacharacters: %.64s\n", > cp2); >- printhost(out, cp2, pub, ca, 0); >+ printhost(out, cp2, kp, pub, >+ ca, 0); > } else >- printhost(out, cp2, pub, ca, 1); >+ printhost(out, cp2, kp, pub, >+ ca, 1); > } > has_unhashed = 1; > } >Index: key.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/key.c,v >retrieving revision 1.98 >diff -u -p -r1.98 key.c >--- key.c 18 Oct 2011 04:58:26 -0000 1.98 >+++ key.c 4 Nov 2011 00:33:21 -0000 >@@ -673,6 +673,8 @@ key_read(Key *ret, char **cpp) > "actual %d", bits, BN_num_bits(ret->rsa->n)); > return -1; > } >+ while (**cpp == ' ' || **cpp == '\t') >+ (*cpp)++; > success = 1; > break; > case KEY_UNSPEC: >@@ -788,6 +790,8 @@ key_read(Key *ret, char **cpp) > while (*cp == ' ' || *cp == '\t') > cp++; > while (*cp != '\0' && *cp != ' ' && *cp != '\t') >+ cp++; >+ while (*cp == ' ' || *cp == '\t') > cp++; > *cpp = cp; > break;
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 1545
:
1589
| 2103 |
2272