|
Lines 26-33
Link Here
|
| 26 |
static void add_listen_addr(ServerOptions *, char *, u_short); |
26 |
static void add_listen_addr(ServerOptions *, char *, u_short); |
| 27 |
static void add_one_listen_addr(ServerOptions *, char *, u_short); |
27 |
static void add_one_listen_addr(ServerOptions *, char *, u_short); |
| 28 |
|
28 |
|
| 29 |
/* AF_UNSPEC or AF_INET or AF_INET6 */ |
|
|
| 30 |
extern int IPv4or6; |
| 31 |
/* Use of privilege separation or not */ |
29 |
/* Use of privilege separation or not */ |
| 32 |
extern int use_privsep; |
30 |
extern int use_privsep; |
| 33 |
|
31 |
|
|
Lines 40-45
Link Here
|
| 40 |
options->num_ports = 0; |
38 |
options->num_ports = 0; |
| 41 |
options->ports_from_cmdline = 0; |
39 |
options->ports_from_cmdline = 0; |
| 42 |
options->listen_addrs = NULL; |
40 |
options->listen_addrs = NULL; |
|
|
41 |
options->address_family = -1; |
| 43 |
options->num_host_key_files = 0; |
42 |
options->num_host_key_files = 0; |
| 44 |
options->pid_file = NULL; |
43 |
options->pid_file = NULL; |
| 45 |
options->server_key_bits = -1; |
44 |
options->server_key_bits = -1; |
|
Lines 235-241
Link Here
|
| 235 |
sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup, |
234 |
sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup, |
| 236 |
sKerberosGetAFSToken, |
235 |
sKerberosGetAFSToken, |
| 237 |
sKerberosTgtPassing, sChallengeResponseAuthentication, |
236 |
sKerberosTgtPassing, sChallengeResponseAuthentication, |
| 238 |
sPasswordAuthentication, sKbdInteractiveAuthentication, sListenAddress, |
237 |
sPasswordAuthentication, sKbdInteractiveAuthentication, |
|
|
238 |
sListenAddress, sAddressFamily, |
| 239 |
sPrintMotd, sPrintLastLog, sIgnoreRhosts, |
239 |
sPrintMotd, sPrintLastLog, sIgnoreRhosts, |
| 240 |
sX11Forwarding, sX11DisplayOffset, sX11UseLocalhost, |
240 |
sX11Forwarding, sX11DisplayOffset, sX11UseLocalhost, |
| 241 |
sStrictModes, sEmptyPasswd, sTCPKeepAlive, |
241 |
sStrictModes, sEmptyPasswd, sTCPKeepAlive, |
|
Lines 300-305
Link Here
|
| 300 |
{ "skeyauthentication", sChallengeResponseAuthentication }, /* alias */ |
300 |
{ "skeyauthentication", sChallengeResponseAuthentication }, /* alias */ |
| 301 |
{ "checkmail", sDeprecated }, |
301 |
{ "checkmail", sDeprecated }, |
| 302 |
{ "listenaddress", sListenAddress }, |
302 |
{ "listenaddress", sListenAddress }, |
|
|
303 |
{ "addressfamily", sAddressFamily }, |
| 303 |
{ "printmotd", sPrintMotd }, |
304 |
{ "printmotd", sPrintMotd }, |
| 304 |
{ "printlastlog", sPrintLastLog }, |
305 |
{ "printlastlog", sPrintLastLog }, |
| 305 |
{ "ignorerhosts", sIgnoreRhosts }, |
306 |
{ "ignorerhosts", sIgnoreRhosts }, |
|
Lines 366-371
Link Here
|
| 366 |
|
367 |
|
| 367 |
if (options->num_ports == 0) |
368 |
if (options->num_ports == 0) |
| 368 |
options->ports[options->num_ports++] = SSH_DEFAULT_PORT; |
369 |
options->ports[options->num_ports++] = SSH_DEFAULT_PORT; |
|
|
370 |
if (options->address_family == -1) |
| 371 |
options->address_family = AF_UNSPEC; |
| 369 |
if (port == 0) |
372 |
if (port == 0) |
| 370 |
for (i = 0; i < options->num_ports; i++) |
373 |
for (i = 0; i < options->num_ports; i++) |
| 371 |
add_one_listen_addr(options, addr, options->ports[i]); |
374 |
add_one_listen_addr(options, addr, options->ports[i]); |
|
Lines 381-387
Link Here
|
| 381 |
int gaierr; |
384 |
int gaierr; |
| 382 |
|
385 |
|
| 383 |
memset(&hints, 0, sizeof(hints)); |
386 |
memset(&hints, 0, sizeof(hints)); |
| 384 |
hints.ai_family = IPv4or6; |
387 |
hints.ai_family = options->address_family; |
| 385 |
hints.ai_socktype = SOCK_STREAM; |
388 |
hints.ai_socktype = SOCK_STREAM; |
| 386 |
hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0; |
389 |
hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0; |
| 387 |
snprintf(strport, sizeof strport, "%u", port); |
390 |
snprintf(strport, sizeof strport, "%u", port); |
|
Lines 501-506
Link Here
|
| 501 |
else |
504 |
else |
| 502 |
fatal("%s line %d: bad inet addr usage.", |
505 |
fatal("%s line %d: bad inet addr usage.", |
| 503 |
filename, linenum); |
506 |
filename, linenum); |
|
|
507 |
break; |
| 508 |
|
| 509 |
case sAddressFamily: |
| 510 |
arg = strdelim(&cp); |
| 511 |
intptr = &options->address_family; |
| 512 |
if (options->listen_addrs != NULL) |
| 513 |
fatal("%s line %d: address family must be specified before " |
| 514 |
"ListenAddress.", filename, linenum); |
| 515 |
if (strcasecmp(arg, "inet") == 0) |
| 516 |
value = AF_INET; |
| 517 |
else if (strcasecmp(arg, "inet6") == 0) |
| 518 |
value = AF_INET6; |
| 519 |
else if (strcasecmp(arg, "any") == 0) |
| 520 |
value = AF_UNSPEC; |
| 521 |
else |
| 522 |
fatal("%s line %d: unsupported address family \"%s\".", |
| 523 |
filename, linenum, arg); |
| 524 |
if (*intptr == -1) |
| 525 |
*intptr = value; |
| 504 |
break; |
526 |
break; |
| 505 |
|
527 |
|
| 506 |
case sHostKeyFile: |
528 |
case sHostKeyFile: |