|
Lines 27-34
Link Here
|
| 27 |
static void add_listen_addr(ServerOptions *, char *, u_short); |
27 |
static void add_listen_addr(ServerOptions *, char *, u_short); |
| 28 |
static void add_one_listen_addr(ServerOptions *, char *, u_short); |
28 |
static void add_one_listen_addr(ServerOptions *, char *, u_short); |
| 29 |
|
29 |
|
| 30 |
/* AF_UNSPEC or AF_INET or AF_INET6 */ |
|
|
| 31 |
extern int IPv4or6; |
| 32 |
/* Use of privilege separation or not */ |
30 |
/* Use of privilege separation or not */ |
| 33 |
extern int use_privsep; |
31 |
extern int use_privsep; |
| 34 |
|
32 |
|
|
Lines 46-51
Link Here
|
| 46 |
options->num_ports = 0; |
44 |
options->num_ports = 0; |
| 47 |
options->ports_from_cmdline = 0; |
45 |
options->ports_from_cmdline = 0; |
| 48 |
options->listen_addrs = NULL; |
46 |
options->listen_addrs = NULL; |
|
|
47 |
options->address_family = -1; |
| 49 |
options->num_host_key_files = 0; |
48 |
options->num_host_key_files = 0; |
| 50 |
options->pid_file = NULL; |
49 |
options->pid_file = NULL; |
| 51 |
options->server_key_bits = -1; |
50 |
options->server_key_bits = -1; |
|
Lines 255-261
Link Here
|
| 255 |
sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup, |
254 |
sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup, |
| 256 |
sKerberosGetAFSToken, |
255 |
sKerberosGetAFSToken, |
| 257 |
sKerberosTgtPassing, sChallengeResponseAuthentication, |
256 |
sKerberosTgtPassing, sChallengeResponseAuthentication, |
| 258 |
sPasswordAuthentication, sKbdInteractiveAuthentication, sListenAddress, |
257 |
sPasswordAuthentication, sKbdInteractiveAuthentication, |
|
|
258 |
sListenAddress, sAddressFamily, |
| 259 |
sPrintMotd, sPrintLastLog, sIgnoreRhosts, |
259 |
sPrintMotd, sPrintLastLog, sIgnoreRhosts, |
| 260 |
sX11Forwarding, sX11DisplayOffset, sX11UseLocalhost, |
260 |
sX11Forwarding, sX11DisplayOffset, sX11UseLocalhost, |
| 261 |
sStrictModes, sEmptyPasswd, sTCPKeepAlive, |
261 |
sStrictModes, sEmptyPasswd, sTCPKeepAlive, |
|
Lines 331-336
Link Here
|
| 331 |
{ "skeyauthentication", sChallengeResponseAuthentication }, /* alias */ |
331 |
{ "skeyauthentication", sChallengeResponseAuthentication }, /* alias */ |
| 332 |
{ "checkmail", sDeprecated }, |
332 |
{ "checkmail", sDeprecated }, |
| 333 |
{ "listenaddress", sListenAddress }, |
333 |
{ "listenaddress", sListenAddress }, |
|
|
334 |
{ "addressfamily", sAddressFamily }, |
| 334 |
{ "printmotd", sPrintMotd }, |
335 |
{ "printmotd", sPrintMotd }, |
| 335 |
{ "printlastlog", sPrintLastLog }, |
336 |
{ "printlastlog", sPrintLastLog }, |
| 336 |
{ "ignorerhosts", sIgnoreRhosts }, |
337 |
{ "ignorerhosts", sIgnoreRhosts }, |
|
Lines 395-400
Link Here
|
| 395 |
|
396 |
|
| 396 |
if (options->num_ports == 0) |
397 |
if (options->num_ports == 0) |
| 397 |
options->ports[options->num_ports++] = SSH_DEFAULT_PORT; |
398 |
options->ports[options->num_ports++] = SSH_DEFAULT_PORT; |
|
|
399 |
if (options->address_family == -1) |
| 400 |
options->address_family = AF_UNSPEC; |
| 398 |
if (port == 0) |
401 |
if (port == 0) |
| 399 |
for (i = 0; i < options->num_ports; i++) |
402 |
for (i = 0; i < options->num_ports; i++) |
| 400 |
add_one_listen_addr(options, addr, options->ports[i]); |
403 |
add_one_listen_addr(options, addr, options->ports[i]); |
|
Lines 410-416
Link Here
|
| 410 |
int gaierr; |
413 |
int gaierr; |
| 411 |
|
414 |
|
| 412 |
memset(&hints, 0, sizeof(hints)); |
415 |
memset(&hints, 0, sizeof(hints)); |
| 413 |
hints.ai_family = IPv4or6; |
416 |
hints.ai_family = options->address_family; |
| 414 |
hints.ai_socktype = SOCK_STREAM; |
417 |
hints.ai_socktype = SOCK_STREAM; |
| 415 |
hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0; |
418 |
hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0; |
| 416 |
snprintf(strport, sizeof strport, "%u", port); |
419 |
snprintf(strport, sizeof strport, "%u", port); |
|
Lines 538-543
Link Here
|
| 538 |
filename, linenum); |
541 |
filename, linenum); |
| 539 |
break; |
542 |
break; |
| 540 |
|
543 |
|
|
|
544 |
case sAddressFamily: |
| 545 |
arg = strdelim(&cp); |
| 546 |
intptr = &options->address_family; |
| 547 |
if (options->listen_addrs != NULL) |
| 548 |
fatal("%s line %d: address family must be specified before " |
| 549 |
"ListenAddress.", filename, linenum); |
| 550 |
if (strcasecmp(arg, "inet") == 0) |
| 551 |
value = AF_INET; |
| 552 |
else if (strcasecmp(arg, "inet6") == 0) |
| 553 |
value = AF_INET6; |
| 554 |
else if (strcasecmp(arg, "any") == 0) |
| 555 |
value = AF_UNSPEC; |
| 556 |
else |
| 557 |
fatal("%s line %d: unsupported address family \"%s\".", |
| 558 |
filename, linenum, arg); |
| 559 |
if (*intptr == -1) |
| 560 |
*intptr = value; |
| 561 |
break; |
| 562 |
|
| 541 |
case sHostKeyFile: |
563 |
case sHostKeyFile: |
| 542 |
intptr = &options->num_host_key_files; |
564 |
intptr = &options->num_host_key_files; |
| 543 |
if (*intptr >= MAX_HOSTKEYS) |
565 |
if (*intptr >= MAX_HOSTKEYS) |