Lines 22-27
Link Here
|
22 |
#include <netinet/ip.h> |
22 |
#include <netinet/ip.h> |
23 |
|
23 |
|
24 |
#include <ctype.h> |
24 |
#include <ctype.h> |
|
|
25 |
#include <fcntl.h> |
25 |
#include <netdb.h> |
26 |
#include <netdb.h> |
26 |
#include <pwd.h> |
27 |
#include <pwd.h> |
27 |
#include <stdio.h> |
28 |
#include <stdio.h> |
Lines 206-229
Link Here
|
206 |
/* Standard Options */ |
207 |
/* Standard Options */ |
207 |
if (options->protocol == SSH_PROTO_UNKNOWN) |
208 |
if (options->protocol == SSH_PROTO_UNKNOWN) |
208 |
options->protocol = SSH_PROTO_2; |
209 |
options->protocol = SSH_PROTO_2; |
|
|
210 |
#define add_host_key_file(path) \ |
211 |
do { \ |
212 |
if (access((path), O_RDONLY) == 0) \ |
213 |
options->host_key_files \ |
214 |
[options->num_host_key_files++] = (path); \ |
215 |
} while (0) |
209 |
if (options->num_host_key_files == 0) { |
216 |
if (options->num_host_key_files == 0) { |
210 |
/* fill default hostkeys for protocols */ |
217 |
/* fill default hostkeys for protocols */ |
211 |
if (options->protocol & SSH_PROTO_1) |
218 |
if (options->protocol & SSH_PROTO_1) |
212 |
options->host_key_files[options->num_host_key_files++] = |
219 |
add_host_key_file(_PATH_HOST_KEY_FILE); |
213 |
_PATH_HOST_KEY_FILE; |
|
|
214 |
if (options->protocol & SSH_PROTO_2) { |
220 |
if (options->protocol & SSH_PROTO_2) { |
215 |
options->host_key_files[options->num_host_key_files++] = |
221 |
add_host_key_file(_PATH_HOST_RSA_KEY_FILE); |
216 |
_PATH_HOST_RSA_KEY_FILE; |
222 |
add_host_key_file(_PATH_HOST_DSA_KEY_FILE); |
217 |
options->host_key_files[options->num_host_key_files++] = |
|
|
218 |
_PATH_HOST_DSA_KEY_FILE; |
219 |
#ifdef OPENSSL_HAS_ECC |
223 |
#ifdef OPENSSL_HAS_ECC |
220 |
options->host_key_files[options->num_host_key_files++] = |
224 |
add_host_key_file(_PATH_HOST_ECDSA_KEY_FILE); |
221 |
_PATH_HOST_ECDSA_KEY_FILE; |
|
|
222 |
#endif |
225 |
#endif |
223 |
options->host_key_files[options->num_host_key_files++] = |
226 |
add_host_key_file(_PATH_HOST_ED25519_KEY_FILE); |
224 |
_PATH_HOST_ED25519_KEY_FILE; |
|
|
225 |
} |
227 |
} |
226 |
} |
228 |
} |
|
|
229 |
#undef add_host_key_file |
230 |
if (options->num_host_key_files == 0) |
231 |
fatal("No host key files found"); |
227 |
/* No certificates by default */ |
232 |
/* No certificates by default */ |
228 |
if (options->num_ports == 0) |
233 |
if (options->num_ports == 0) |
229 |
options->ports[options->num_ports++] = SSH_DEFAULT_PORT; |
234 |
options->ports[options->num_ports++] = SSH_DEFAULT_PORT; |