|
Lines 519-530
confirm(const char *prompt)
Link Here
|
| 519 |
* is not valid. the user_hostfile will not be updated if 'readonly' is true. |
519 |
* is not valid. the user_hostfile will not be updated if 'readonly' is true. |
| 520 |
*/ |
520 |
*/ |
| 521 |
static int |
521 |
static int |
| 522 |
check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, |
522 |
check_host_key(char *hostname, struct sockaddr *hostaddr, Key *host_key, |
| 523 |
int readonly, const char *user_hostfile, const char *system_hostfile) |
523 |
int readonly, const char *user_hostfile, const char *system_hostfile) |
| 524 |
{ |
524 |
{ |
| 525 |
Key *file_key; |
525 |
Key *file_key; |
| 526 |
const char *type = key_type(host_key); |
526 |
const char *type = key_type(host_key); |
| 527 |
char *ip = NULL; |
527 |
char *ip = NULL, *host = NULL; |
| 528 |
char hostline[1000], *hostp, *fp; |
528 |
char hostline[1000], *hostp, *fp; |
| 529 |
HostStatus host_status; |
529 |
HostStatus host_status; |
| 530 |
HostStatus ip_status; |
530 |
HostStatus ip_status; |
|
Lines 576-581
check_host_key(char *host, struct sockad
Link Here
|
| 576 |
NULL, 0, NI_NUMERICHOST) != 0) |
576 |
NULL, 0, NI_NUMERICHOST) != 0) |
| 577 |
fatal("check_host_key: getnameinfo failed"); |
577 |
fatal("check_host_key: getnameinfo failed"); |
| 578 |
ip = xstrdup(ntop); |
578 |
ip = xstrdup(ntop); |
|
|
579 |
ip = put_host_port(ntop, options.port); |
| 579 |
} else { |
580 |
} else { |
| 580 |
ip = xstrdup("<no hostip for proxy command>"); |
581 |
ip = xstrdup("<no hostip for proxy command>"); |
| 581 |
} |
582 |
} |
|
Lines 583-600
check_host_key(char *host, struct sockad
Link Here
|
| 583 |
* Turn off check_host_ip if the connection is to localhost, via proxy |
584 |
* Turn off check_host_ip if the connection is to localhost, via proxy |
| 584 |
* command or if we don't have a hostname to compare with |
585 |
* command or if we don't have a hostname to compare with |
| 585 |
*/ |
586 |
*/ |
| 586 |
if (options.check_host_ip && |
587 |
if (options.check_host_ip && (local || |
| 587 |
(local || strcmp(host, ip) == 0 || options.proxy_command != NULL)) |
588 |
strcmp(hostname, ip) == 0 || options.proxy_command != NULL)) |
| 588 |
options.check_host_ip = 0; |
589 |
options.check_host_ip = 0; |
| 589 |
|
590 |
|
| 590 |
/* |
591 |
/* |
| 591 |
* Allow the user to record the key under a different name. This is |
592 |
* Allow the user to record the key under a different name or |
| 592 |
* useful for ssh tunneling over forwarded connections or if you run |
593 |
* differentiate a non-standard port. This is useful for ssh |
| 593 |
* multiple sshd's on different ports on the same machine. |
594 |
* tunneling over forwarded connections or if you run multiple |
|
|
595 |
* sshd's on different ports on the same machine. |
| 594 |
*/ |
596 |
*/ |
| 595 |
if (options.host_key_alias != NULL) { |
597 |
if (options.host_key_alias != NULL) { |
| 596 |
host = options.host_key_alias; |
598 |
host = xstrdup(options.host_key_alias); |
| 597 |
debug("using hostkeyalias: %s", host); |
599 |
debug("using hostkeyalias: %s", host); |
|
|
600 |
} else { |
| 601 |
host = put_host_port(hostname, options.port); |
| 598 |
} |
602 |
} |
| 599 |
|
603 |
|
| 600 |
/* |
604 |
/* |
|
Lines 856-865
check_host_key(char *host, struct sockad
Link Here
|
| 856 |
} |
860 |
} |
| 857 |
|
861 |
|
| 858 |
xfree(ip); |
862 |
xfree(ip); |
|
|
863 |
xfree(host); |
| 859 |
return 0; |
864 |
return 0; |
| 860 |
|
865 |
|
| 861 |
fail: |
866 |
fail: |
| 862 |
xfree(ip); |
867 |
xfree(ip); |
|
|
868 |
xfree(host); |
| 863 |
return -1; |
869 |
return -1; |
| 864 |
} |
870 |
} |
| 865 |
|
871 |
|