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

Collapse All | Expand All

(-)a/hostfile.c (+6 lines)
Lines 523-528 add_host_to_hostfile(const char *filename, const char *host, Link Here
523
	f = fopen(filename, "a");
523
	f = fopen(filename, "a");
524
	if (!f)
524
	if (!f)
525
		return 0;
525
		return 0;
526
	/* Make sure we have a terminating newline. */
527
	if (fseek(f, -1, SEEK_CUR) == 0 && fgetc(f) != '\n')
528
		if (fputc('\n', f) != '\n') {
529
			debug3_f("failed to add terminating newline");
530
			return 0;
531
		}
526
	success = write_host_entry(f, host, NULL, key, store_hash);
532
	success = write_host_entry(f, host, NULL, key, store_hash);
527
	fclose(f);
533
	fclose(f);
528
	return success;
534
	return success;
(-)a/regress/knownhosts.sh (+7 lines)
Lines 15-17 ${SSH} -ohashknownhosts=yes -o stricthostkeychecking=no $opts somehost true \ Link Here
15
15
16
trace "test hashed known hosts"
16
trace "test hashed known hosts"
17
${SSH} $opts somehost true || fail "reconnect with hashed known hosts"
17
${SSH} $opts somehost true || fail "reconnect with hashed known hosts"
18
19
trace "no newline at end of known_hosts"
20
printf "something" >$OBJ/known_hosts
21
${SSH} $opts -ostricthostkeychecking=no somehost true \
22
    || fail "hostkey update, missing newline, no strict"
23
${SSH} $opts -ostricthostkeychecking=yes somehost true \
24
    || fail "reconnect after adding with missing newline"

Return to bug 3529