version 1.137.2.3, 2005/09/02 03:45:00 |
version 1.138, 2004/12/23 23:11:00 |
|
|
if (options->use_login == -1) |
if (options->use_login == -1) |
options->use_login = 0; |
options->use_login = 0; |
if (options->compression == -1) |
if (options->compression == -1) |
options->compression = COMP_DELAYED; |
options->compression = 1; |
if (options->allow_tcp_forwarding == -1) |
if (options->allow_tcp_forwarding == -1) |
options->allow_tcp_forwarding = 1; |
options->allow_tcp_forwarding = 1; |
if (options->gateway_ports == -1) |
if (options->gateway_ports == -1) |
|
|
static void |
static void |
add_listen_addr(ServerOptions *options, char *addr, u_short port) |
add_listen_addr(ServerOptions *options, char *addr, u_short port) |
{ |
{ |
u_int i; |
int i; |
|
|
if (options->num_ports == 0) |
if (options->num_ports == 0) |
options->ports[options->num_ports++] = SSH_DEFAULT_PORT; |
options->ports[options->num_ports++] = SSH_DEFAULT_PORT; |
|
|
const char *filename, int linenum) |
const char *filename, int linenum) |
{ |
{ |
char *cp, **charptr, *arg, *p; |
char *cp, **charptr, *arg, *p; |
int *intptr, value, n; |
int *intptr, value, i, n; |
ServerOpCodes opcode; |
ServerOpCodes opcode; |
u_short port; |
|
u_int i; |
|
|
|
cp = line; |
cp = line; |
arg = strdelim(&cp); |
arg = strdelim(&cp); |
|
|
|
|
case sListenAddress: |
case sListenAddress: |
arg = strdelim(&cp); |
arg = strdelim(&cp); |
if (arg == NULL || *arg == '\0') |
if (!arg || *arg == '\0' || strncmp(arg, "[]", 2) == 0) |
fatal("%s line %d: missing address", |
fatal("%s line %d: missing inet addr.", |
filename, linenum); |
filename, linenum); |
/* check for bare IPv6 address: no "[]" and 2 or more ":" */ |
if (*arg == '[') { |
if (strchr(arg, '[') == NULL && (p = strchr(arg, ':')) != NULL |
if ((p = strchr(arg, ']')) == NULL) |
&& strchr(p+1, ':') != NULL) { |
fatal("%s line %d: bad ipv6 inet addr usage.", |
|
filename, linenum); |
|
arg++; |
|
memmove(p, p+1, strlen(p+1)+1); |
|
} else if (((p = strchr(arg, ':')) == NULL) || |
|
(strchr(p+1, ':') != NULL)) { |
add_listen_addr(options, arg, 0); |
add_listen_addr(options, arg, 0); |
break; |
break; |
} |
} |
p = hpdelim(&arg); |
if (*p == ':') { |
if (p == NULL) |
u_short port; |
fatal("%s line %d: bad address:port usage", |
|
filename, linenum); |
|
p = cleanhostname(p); |
|
if (arg == NULL) |
|
port = 0; |
|
else if ((port = a2port(arg)) == 0) |
|
fatal("%s line %d: bad port number", filename, linenum); |
|
|
|
add_listen_addr(options, p, port); |
p++; |
|
if (*p == '\0') |
|
fatal("%s line %d: bad inet addr:port usage.", |
|
filename, linenum); |
|
else { |
|
*(p-1) = '\0'; |
|
if ((port = a2port(p)) == 0) |
|
fatal("%s line %d: bad port number.", |
|
filename, linenum); |
|
add_listen_addr(options, arg, port); |
|
} |
|
} else if (*p == '\0') |
|
add_listen_addr(options, arg, 0); |
|
else |
|
fatal("%s line %d: bad inet addr usage.", |
|
filename, linenum); |
break; |
break; |
|
|
case sAddressFamily: |
case sAddressFamily: |
arg = strdelim(&cp); |
arg = strdelim(&cp); |
if (!arg || *arg == '\0') |
|
fatal("%s line %d: missing address family.", |
|
filename, linenum); |
|
intptr = &options->address_family; |
intptr = &options->address_family; |
if (options->listen_addrs != NULL) |
if (options->listen_addrs != NULL) |
fatal("%s line %d: address family must be specified before " |
fatal("%s line %d: address family must be specified before " |
|
|
|
|
case sCompression: |
case sCompression: |
intptr = &options->compression; |
intptr = &options->compression; |
arg = strdelim(&cp); |
goto parse_flag; |
if (!arg || *arg == '\0') |
|
fatal("%s line %d: missing yes/no/delayed " |
|
"argument.", filename, linenum); |
|
value = 0; /* silence compiler */ |
|
if (strcmp(arg, "delayed") == 0) |
|
value = COMP_DELAYED; |
|
else if (strcmp(arg, "yes") == 0) |
|
value = COMP_ZLIB; |
|
else if (strcmp(arg, "no") == 0) |
|
value = COMP_NONE; |
|
else |
|
fatal("%s line %d: Bad yes/no/delayed " |
|
"argument: %s", filename, linenum, arg); |
|
if (*intptr == -1) |
|
*intptr = value; |
|
break; |
|
|
|
case sGatewayPorts: |
case sGatewayPorts: |
intptr = &options->gateway_ports; |
intptr = &options->gateway_ports; |
arg = strdelim(&cp); |
goto parse_flag; |
if (!arg || *arg == '\0') |
|
fatal("%s line %d: missing yes/no/clientspecified " |
|
"argument.", filename, linenum); |
|
value = 0; /* silence compiler */ |
|
if (strcmp(arg, "clientspecified") == 0) |
|
value = 2; |
|
else if (strcmp(arg, "yes") == 0) |
|
value = 1; |
|
else if (strcmp(arg, "no") == 0) |
|
value = 0; |
|
else |
|
fatal("%s line %d: Bad yes/no/clientspecified " |
|
"argument: %s", filename, linenum, arg); |
|
if (*intptr == -1) |
|
*intptr = value; |
|
break; |
|
|
|
case sUseDNS: |
case sUseDNS: |
intptr = &options->use_dns; |
intptr = &options->use_dns; |
|
|
|
|
obuf = cbuf = xstrdup(buffer_ptr(conf)); |
obuf = cbuf = xstrdup(buffer_ptr(conf)); |
linenum = 1; |
linenum = 1; |
while ((cp = strsep(&cbuf, "\n")) != NULL) { |
while((cp = strsep(&cbuf, "\n")) != NULL) { |
if (process_server_config_line(options, cp, filename, |
if (process_server_config_line(options, cp, filename, |
linenum++) != 0) |
linenum++) != 0) |
bad_options++; |
bad_options++; |