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

Collapse All | Expand All

(-)hostfile.c (-6 / +11 lines)
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
(-)ssh-keygen.c (+1 lines)
Lines 1092-1097 known_hosts_hash(struct hostkey_foreach_ Link Here
1092
		 */
1092
		 */
1093
		ohosts = hosts = xstrdup(l->hosts);
1093
		ohosts = hosts = xstrdup(l->hosts);
1094
		while ((cp = strsep(&hosts, ",")) != NULL && *cp != '\0') {
1094
		while ((cp = strsep(&hosts, ",")) != NULL && *cp != '\0') {
1095
			lowercase(cp);
1095
			if ((hashed = host_hash(cp, NULL, 0)) == NULL)
1096
			if ((hashed = host_hash(cp, NULL, 0)) == NULL)
1096
				fatal("hash_host failed");
1097
				fatal("hash_host failed");
1097
			fprintf(ctx->out, "%s %s\n", hashed, l->rawkey);
1098
			fprintf(ctx->out, "%s %s\n", hashed, l->rawkey);
(-)ssh-keyscan.c (+1 lines)
Lines 307-312 keyprint_one(const char *host, struct ss Link Here
307
	const char *known_host, *hashed;
307
	const char *known_host, *hashed;
308
308
309
	hostport = put_host_port(host, ssh_port);
309
	hostport = put_host_port(host, ssh_port);
310
	lowercase(hostport);
310
	if (hash_hosts && (hashed = host_hash(host, NULL, 0)) == NULL)
311
	if (hash_hosts && (hashed = host_hash(host, NULL, 0)) == NULL)
311
		fatal("host_hash failed");
312
		fatal("host_hash failed");
312
	known_host = hash_hosts ? hashed : hostport;
313
	known_host = hash_hosts ? hashed : hostport;

Return to bug 2591