|
Lines 863-869
check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
Link Here
|
| 863 |
if (readonly || want_cert) |
863 |
if (readonly || want_cert) |
| 864 |
goto fail; |
864 |
goto fail; |
| 865 |
/* The host is new. */ |
865 |
/* The host is new. */ |
| 866 |
if (options.strict_host_key_checking == 1) { |
866 |
if (options.strict_host_key_checking == |
|
|
867 |
SSH_STRICT_HOSTKEY_YES) { |
| 867 |
/* |
868 |
/* |
| 868 |
* User has requested strict host key checking. We |
869 |
* User has requested strict host key checking. We |
| 869 |
* will not add the host key automatically. The only |
870 |
* will not add the host key automatically. The only |
|
Lines 872-878
check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
Link Here
|
| 872 |
error("No %s host key is known for %.200s and you " |
873 |
error("No %s host key is known for %.200s and you " |
| 873 |
"have requested strict checking.", type, host); |
874 |
"have requested strict checking.", type, host); |
| 874 |
goto fail; |
875 |
goto fail; |
| 875 |
} else if (options.strict_host_key_checking == 2) { |
876 |
} else if (options.strict_host_key_checking == |
|
|
877 |
SSH_STRICT_HOSTKEY_ASK) { |
| 876 |
char msg1[1024], msg2[1024]; |
878 |
char msg1[1024], msg2[1024]; |
| 877 |
|
879 |
|
| 878 |
if (show_other_keys(host_hostkeys, host_key)) |
880 |
if (show_other_keys(host_hostkeys, host_key)) |
|
Lines 916-923
check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
Link Here
|
| 916 |
hostkey_trusted = 1; /* user explicitly confirmed */ |
918 |
hostkey_trusted = 1; /* user explicitly confirmed */ |
| 917 |
} |
919 |
} |
| 918 |
/* |
920 |
/* |
| 919 |
* If not in strict mode, add the key automatically to the |
921 |
* If in "new" or "off" strict mode, add the key automatically |
| 920 |
* local known_hosts file. |
922 |
* to the local known_hosts file. |
| 921 |
*/ |
923 |
*/ |
| 922 |
if (options.check_host_ip && ip_status == HOST_NEW) { |
924 |
if (options.check_host_ip && ip_status == HOST_NEW) { |
| 923 |
snprintf(hostline, sizeof(hostline), "%s,%s", host, ip); |
925 |
snprintf(hostline, sizeof(hostline), "%s,%s", host, ip); |
|
Lines 959-965
check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
Link Here
|
| 959 |
* If strict host key checking is in use, the user will have |
961 |
* If strict host key checking is in use, the user will have |
| 960 |
* to edit the key manually and we can only abort. |
962 |
* to edit the key manually and we can only abort. |
| 961 |
*/ |
963 |
*/ |
| 962 |
if (options.strict_host_key_checking) { |
964 |
if (options.strict_host_key_checking != |
|
|
965 |
SSH_STRICT_HOSTKEY_OFF) { |
| 963 |
error("%s host key for %.200s was revoked and you have " |
966 |
error("%s host key for %.200s was revoked and you have " |
| 964 |
"requested strict checking.", type, host); |
967 |
"requested strict checking.", type, host); |
| 965 |
goto fail; |
968 |
goto fail; |
|
Lines 1012-1018
check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
Link Here
|
| 1012 |
* If strict host key checking is in use, the user will have |
1015 |
* If strict host key checking is in use, the user will have |
| 1013 |
* to edit the key manually and we can only abort. |
1016 |
* to edit the key manually and we can only abort. |
| 1014 |
*/ |
1017 |
*/ |
| 1015 |
if (options.strict_host_key_checking) { |
1018 |
if (options.strict_host_key_checking != |
|
|
1019 |
SSH_STRICT_HOSTKEY_OFF) { |
| 1016 |
error("%s host key for %.200s has changed and you have " |
1020 |
error("%s host key for %.200s has changed and you have " |
| 1017 |
"requested strict checking.", type, host); |
1021 |
"requested strict checking.", type, host); |
| 1018 |
goto fail; |
1022 |
goto fail; |
|
Lines 1099-1113
check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
Link Here
|
| 1099 |
"\nMatching host key in %s:%lu", |
1103 |
"\nMatching host key in %s:%lu", |
| 1100 |
host_found->file, host_found->line); |
1104 |
host_found->file, host_found->line); |
| 1101 |
} |
1105 |
} |
| 1102 |
if (options.strict_host_key_checking == 1) { |
1106 |
if (options.strict_host_key_checking == |
| 1103 |
logit("%s", msg); |
1107 |
SSH_STRICT_HOSTKEY_ASK) { |
| 1104 |
error("Exiting, you have requested strict checking."); |
|
|
| 1105 |
goto fail; |
| 1106 |
} else if (options.strict_host_key_checking == 2) { |
| 1107 |
strlcat(msg, "\nAre you sure you want " |
1108 |
strlcat(msg, "\nAre you sure you want " |
| 1108 |
"to continue connecting (yes/no)? ", sizeof(msg)); |
1109 |
"to continue connecting (yes/no)? ", sizeof(msg)); |
| 1109 |
if (!confirm(msg)) |
1110 |
if (!confirm(msg)) |
| 1110 |
goto fail; |
1111 |
goto fail; |
|
|
1112 |
} else if (options.strict_host_key_checking != |
| 1113 |
SSH_STRICT_HOSTKEY_OFF) { |
| 1114 |
logit("%s", msg); |
| 1115 |
error("Exiting, you have requested strict checking."); |
| 1116 |
goto fail; |
| 1111 |
} else { |
1117 |
} else { |
| 1112 |
logit("%s", msg); |
1118 |
logit("%s", msg); |
| 1113 |
} |
1119 |
} |