version 1.160, 2005/03/01 10:40:27 |
version 1.161, 2005/03/02 01:00:06 |
|
|
char hostline[1000], *hostp, *fp; |
char hostline[1000], *hostp, *fp; |
HostStatus host_status; |
HostStatus host_status; |
HostStatus ip_status; |
HostStatus ip_status; |
int local = 0, host_ip_differ = 0; |
int r, local = 0, host_ip_differ = 0; |
char ntop[NI_MAXHOST]; |
char ntop[NI_MAXHOST]; |
char msg[1024]; |
char msg[1024]; |
int len, host_line, ip_line; |
int len, host_line, ip_line; |
|
|
if (!confirm(msg)) |
if (!confirm(msg)) |
goto fail; |
goto fail; |
} |
} |
if (options.check_host_ip && ip_status == HOST_NEW) { |
|
snprintf(hostline, sizeof(hostline), "%s,%s", host, ip); |
|
hostp = hostline; |
|
} else |
|
hostp = host; |
|
|
|
/* |
/* |
* If not in strict mode, add the key automatically to the |
* If not in strict mode, add the key automatically to the |
* local known_hosts file. |
* local known_hosts file. |
*/ |
*/ |
if (!add_host_to_hostfile(user_hostfile, hostp, host_key, |
if (options.check_host_ip && ip_status == HOST_NEW) { |
options.hash_known_hosts)) |
snprintf(hostline, sizeof(hostline), "%s,%s", |
|
host, ip); |
|
hostp = hostline; |
|
if (options.hash_known_hosts) { |
|
/* Add hash of host and IP separately */ |
|
r = add_host_to_hostfile(user_hostfile, host, |
|
host_key, options.hash_known_hosts) && |
|
add_host_to_hostfile(user_hostfile, ip, |
|
host_key, options.hash_known_hosts); |
|
} else { |
|
/* Add unhashed "host,ip" */ |
|
r = add_host_to_hostfile(user_hostfile, |
|
hostline, host_key, |
|
options.hash_known_hosts); |
|
} |
|
} else { |
|
r = add_host_to_hostfile(user_hostfile, host, host_key, |
|
options.hash_known_hosts); |
|
hostp = host; |
|
} |
|
|
|
if (!r) |
logit("Failed to add the host to the list of known " |
logit("Failed to add the host to the list of known " |
"hosts (%.500s).", user_hostfile); |
"hosts (%.500s).", user_hostfile); |
else |
else |