|
Line
Link Here
|
| 0 |
-- a/ssh-keygen.c |
0 |
++ b/ssh-keygen.c |
|
Lines 965-971
Link Here
|
| 965 |
} |
965 |
} |
| 966 |
|
966 |
|
| 967 |
static void |
967 |
static void |
| 968 |
printhost(FILE *f, const char *name, Key *public, int ca, int hash) |
968 |
printhost(FILE *f, const char *name, const char *comment, Key *public, |
|
|
969 |
int ca, int hash) |
| 969 |
{ |
970 |
{ |
| 970 |
if (print_fingerprint) { |
971 |
if (print_fingerprint) { |
| 971 |
enum fp_rep rep; |
972 |
enum fp_rep rep; |
|
Lines 988-993
Link Here
|
| 988 |
fprintf(f, "%s%s%s ", ca ? CA_MARKER : "", ca ? " " : "", name); |
989 |
fprintf(f, "%s%s%s ", ca ? CA_MARKER : "", ca ? " " : "", name); |
| 989 |
if (!key_write(public, f)) |
990 |
if (!key_write(public, f)) |
| 990 |
fatal("key_write failed"); |
991 |
fatal("key_write failed"); |
|
|
992 |
if (comment != NULL && *comment) |
| 993 |
fprintf(f, " %s", comment); |
| 991 |
fprintf(f, "\n"); |
994 |
fprintf(f, "\n"); |
| 992 |
} |
995 |
} |
| 993 |
} |
996 |
} |
|
Lines 1091-1097
Link Here
|
| 1091 |
continue; |
1094 |
continue; |
| 1092 |
} |
1095 |
} |
| 1093 |
} |
1096 |
} |
| 1094 |
|
|
|
| 1095 |
if (*cp == HASH_DELIM) { |
1097 |
if (*cp == HASH_DELIM) { |
| 1096 |
if (find_host || delete_host) { |
1098 |
if (find_host || delete_host) { |
| 1097 |
cp2 = host_hash(name, cp, strlen(cp)); |
1099 |
cp2 = host_hash(name, cp, strlen(cp)); |
|
Lines 1107-1124
Link Here
|
| 1107 |
"line %d type %s%s\n", name, |
1109 |
"line %d type %s%s\n", name, |
| 1108 |
num, key_type(pub), |
1110 |
num, key_type(pub), |
| 1109 |
ca ? " (CA key)" : ""); |
1111 |
ca ? " (CA key)" : ""); |
| 1110 |
printhost(out, cp, pub, ca, 0); |
1112 |
printhost(out, cp, kp, pub, ca, 0); |
| 1111 |
} |
1113 |
} |
| 1112 |
if (delete_host) { |
1114 |
if (delete_host) { |
| 1113 |
if (!c && !ca) |
1115 |
if (!c && !ca) |
| 1114 |
printhost(out, cp, pub, ca, 0); |
1116 |
printhost(out, cp, kp, pub, ca, 0); |
| 1115 |
else |
1117 |
else |
| 1116 |
printf("# Host %s found: " |
1118 |
printf("# Host %s found: " |
| 1117 |
"line %d type %s\n", name, |
1119 |
"line %d type %s\n", name, |
| 1118 |
num, key_type(pub)); |
1120 |
num, key_type(pub)); |
| 1119 |
} |
1121 |
} |
| 1120 |
} else if (hash_hosts) |
1122 |
} else if (hash_hosts) |
| 1121 |
printhost(out, cp, pub, ca, 0); |
1123 |
printhost(out, cp, kp, pub, ca, 0); |
| 1122 |
} else { |
1124 |
} else { |
| 1123 |
if (find_host || delete_host) { |
1125 |
if (find_host || delete_host) { |
| 1124 |
c = (match_hostname(name, cp, |
1126 |
c = (match_hostname(name, cp, |
|
Lines 1128-1139
Link Here
|
| 1128 |
"line %d type %s%s\n", name, |
1130 |
"line %d type %s%s\n", name, |
| 1129 |
num, key_type(pub), |
1131 |
num, key_type(pub), |
| 1130 |
ca ? " (CA key)" : ""); |
1132 |
ca ? " (CA key)" : ""); |
| 1131 |
printhost(out, name, pub, |
1133 |
printhost(out, name, kp, pub, |
| 1132 |
ca, hash_hosts && !ca); |
1134 |
ca, hash_hosts && !ca); |
| 1133 |
} |
1135 |
} |
| 1134 |
if (delete_host) { |
1136 |
if (delete_host) { |
| 1135 |
if (!c && !ca) |
1137 |
if (!c && !ca) |
| 1136 |
printhost(out, cp, pub, ca, 0); |
1138 |
printhost(out, cp, kp, pub, ca, 0); |
| 1137 |
else |
1139 |
else |
| 1138 |
printf("# Host %s found: " |
1140 |
printf("# Host %s found: " |
| 1139 |
"line %d type %s\n", name, |
1141 |
"line %d type %s\n", name, |
|
Lines 1147-1162
Link Here
|
| 1147 |
fprintf(stderr, "Warning: " |
1149 |
fprintf(stderr, "Warning: " |
| 1148 |
"ignoring CA key for host: " |
1150 |
"ignoring CA key for host: " |
| 1149 |
"%.64s\n", cp2); |
1151 |
"%.64s\n", cp2); |
| 1150 |
printhost(out, cp2, pub, ca, 0); |
1152 |
printhost(out, cp2, kp, pub, |
|
|
1153 |
ca, 0); |
| 1151 |
} else if (strcspn(cp2, "*?!") != |
1154 |
} else if (strcspn(cp2, "*?!") != |
| 1152 |
strlen(cp2)) { |
1155 |
strlen(cp2)) { |
| 1153 |
fprintf(stderr, "Warning: " |
1156 |
fprintf(stderr, "Warning: " |
| 1154 |
"ignoring host name with " |
1157 |
"ignoring host name with " |
| 1155 |
"metacharacters: %.64s\n", |
1158 |
"metacharacters: %.64s\n", |
| 1156 |
cp2); |
1159 |
cp2); |
| 1157 |
printhost(out, cp2, pub, ca, 0); |
1160 |
printhost(out, cp2, kp, pub, |
|
|
1161 |
ca, 0); |
| 1158 |
} else |
1162 |
} else |
| 1159 |
printhost(out, cp2, pub, ca, 1); |
1163 |
printhost(out, cp2, kp, pub, |
|
|
1164 |
ca, 1); |
| 1160 |
} |
1165 |
} |
| 1161 |
has_unhashed = 1; |
1166 |
has_unhashed = 1; |
| 1162 |
} |
1167 |
} |
| 1163 |
-- a/key.c |
1168 |
++ b/key.c |
|
Lines 693-698
Link Here
|
| 693 |
"actual %d", bits, BN_num_bits(ret->rsa->n)); |
693 |
"actual %d", bits, BN_num_bits(ret->rsa->n)); |
| 694 |
return -1; |
694 |
return -1; |
| 695 |
} |
695 |
} |
|
|
696 |
while (**cpp == ' ' || **cpp == '\t') |
| 697 |
(*cpp)++; |
| 696 |
success = 1; |
698 |
success = 1; |
| 697 |
break; |
699 |
break; |
| 698 |
case KEY_UNSPEC: |
700 |
case KEY_UNSPEC: |
|
Lines 815-820
Link Here
|
| 815 |
cp++; |
817 |
cp++; |
| 816 |
while (*cp != '\0' && *cp != ' ' && *cp != '\t') |
818 |
while (*cp != '\0' && *cp != ' ' && *cp != '\t') |
| 817 |
cp++; |
819 |
cp++; |
|
|
820 |
while (*cp == ' ' || *cp == '\t') |
| 821 |
cp++; |
| 818 |
*cpp = cp; |
822 |
*cpp = cp; |
| 819 |
break; |
823 |
break; |
| 820 |
default: |
824 |
default: |