|
Lines 416-434
write_host_entry(FILE *f, const char *ho
Link Here
|
| 416 |
const struct sshkey *key, int store_hash) |
416 |
const struct sshkey *key, int store_hash) |
| 417 |
{ |
417 |
{ |
| 418 |
int r, success = 0; |
418 |
int r, success = 0; |
| 419 |
char *hashed_host = NULL; |
419 |
char *hashed_host = NULL, *lhost; |
|
|
420 |
|
| 421 |
lhost = xstrdup(host); |
| 422 |
lowercase(lhost); |
| 420 |
|
423 |
|
| 421 |
if (store_hash) { |
424 |
if (store_hash) { |
| 422 |
if ((hashed_host = host_hash(host, NULL, 0)) == NULL) { |
425 |
if ((hashed_host = host_hash(lhost, NULL, 0)) == NULL) { |
| 423 |
error("%s: host_hash failed", __func__); |
426 |
error("%s: host_hash failed", __func__); |
|
|
427 |
free(lhost); |
| 424 |
return 0; |
428 |
return 0; |
| 425 |
} |
429 |
} |
| 426 |
fprintf(f, "%s ", hashed_host); |
430 |
fprintf(f, "%s ", hashed_host); |
| 427 |
} else if (ip != NULL) |
431 |
} else if (ip != NULL) |
| 428 |
fprintf(f, "%s,%s ", host, ip); |
432 |
fprintf(f, "%s,%s ", lhost, ip); |
| 429 |
else |
433 |
else { |
| 430 |
fprintf(f, "%s ", host); |
434 |
fprintf(f, "%s ", lhost); |
| 431 |
|
435 |
} |
|
|
436 |
free(lhost); |
| 432 |
if ((r = sshkey_write(key, f)) == 0) |
437 |
if ((r = sshkey_write(key, f)) == 0) |
| 433 |
success = 1; |
438 |
success = 1; |
| 434 |
else |
439 |
else |