View | Details | Raw Unified | Return to bug 2591 | Differences between
and this patch

Collapse All | Expand All

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

Return to bug 2591