version 1.53, 2000/10/14 12:12:09 |
version 1.54, 2000/11/12 19:50:38 |
|
|
options->num_ports = 0; |
options->num_ports = 0; |
options->ports_from_cmdline = 0; |
options->ports_from_cmdline = 0; |
options->listen_addrs = NULL; |
options->listen_addrs = NULL; |
options->host_key_file = NULL; |
options->num_host_key_files = 0; |
options->host_dsa_key_file = NULL; |
|
options->pid_file = NULL; |
options->pid_file = NULL; |
options->server_key_bits = -1; |
options->server_key_bits = -1; |
options->login_grace_time = -1; |
options->login_grace_time = -1; |
|
|
options->rhosts_authentication = -1; |
options->rhosts_authentication = -1; |
options->rhosts_rsa_authentication = -1; |
options->rhosts_rsa_authentication = -1; |
options->rsa_authentication = -1; |
options->rsa_authentication = -1; |
options->dsa_authentication = -1; |
options->pubkey_authentication = -1; |
#ifdef KRB4 |
#ifdef KRB4 |
options->kerberos_authentication = -1; |
options->kerberos_authentication = -1; |
options->kerberos_or_local_passwd = -1; |
options->kerberos_or_local_passwd = -1; |
|
|
void |
void |
fill_default_server_options(ServerOptions *options) |
fill_default_server_options(ServerOptions *options) |
{ |
{ |
|
if (options->protocol == SSH_PROTO_UNKNOWN) |
|
options->protocol = SSH_PROTO_1|SSH_PROTO_2; |
|
if (options->num_host_key_files == 0) { |
|
/* fill default hostkeys for protocols */ |
|
if (options->protocol & SSH_PROTO_1) |
|
options->host_key_files[options->num_host_key_files++] = HOST_KEY_FILE; |
|
if (options->protocol & SSH_PROTO_2) |
|
options->host_key_files[options->num_host_key_files++] = HOST_DSA_KEY_FILE; |
|
} |
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; |
if (options->listen_addrs == NULL) |
if (options->listen_addrs == NULL) |
add_listen_addr(options, NULL); |
add_listen_addr(options, NULL); |
if (options->host_key_file == NULL) |
|
options->host_key_file = HOST_KEY_FILE; |
|
if (options->host_dsa_key_file == NULL) |
|
options->host_dsa_key_file = HOST_DSA_KEY_FILE; |
|
if (options->pid_file == NULL) |
if (options->pid_file == NULL) |
options->pid_file = SSH_DAEMON_PID_FILE; |
options->pid_file = SSH_DAEMON_PID_FILE; |
if (options->server_key_bits == -1) |
if (options->server_key_bits == -1) |
|
|
options->rhosts_rsa_authentication = 0; |
options->rhosts_rsa_authentication = 0; |
if (options->rsa_authentication == -1) |
if (options->rsa_authentication == -1) |
options->rsa_authentication = 1; |
options->rsa_authentication = 1; |
if (options->dsa_authentication == -1) |
if (options->pubkey_authentication == -1) |
options->dsa_authentication = 1; |
options->pubkey_authentication = 1; |
#ifdef KRB4 |
#ifdef KRB4 |
if (options->kerberos_authentication == -1) |
if (options->kerberos_authentication == -1) |
options->kerberos_authentication = (access(KEYFILE, R_OK) == 0); |
options->kerberos_authentication = (access(KEYFILE, R_OK) == 0); |
|
|
options->use_login = 0; |
options->use_login = 0; |
if (options->allow_tcp_forwarding == -1) |
if (options->allow_tcp_forwarding == -1) |
options->allow_tcp_forwarding = 1; |
options->allow_tcp_forwarding = 1; |
if (options->protocol == SSH_PROTO_UNKNOWN) |
|
options->protocol = SSH_PROTO_1|SSH_PROTO_2; |
|
if (options->gateway_ports == -1) |
if (options->gateway_ports == -1) |
options->gateway_ports = 0; |
options->gateway_ports = 0; |
if (options->max_startups == -1) |
if (options->max_startups == -1) |
|
|
sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives, sCheckMail, |
sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives, sCheckMail, |
sUseLogin, sAllowTcpForwarding, |
sUseLogin, sAllowTcpForwarding, |
sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups, |
sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups, |
sIgnoreUserKnownHosts, sHostDSAKeyFile, sCiphers, sProtocol, sPidFile, |
sIgnoreUserKnownHosts, sCiphers, sProtocol, sPidFile, |
sGatewayPorts, sDSAAuthentication, sXAuthLocation, sSubsystem, sMaxStartups |
sGatewayPorts, sPubkeyAuthentication, sXAuthLocation, sSubsystem, sMaxStartups, |
} ServerOpCodes; |
} ServerOpCodes; |
|
|
/* Textual representation of the tokens. */ |
/* Textual representation of the tokens. */ |
|
|
} keywords[] = { |
} keywords[] = { |
{ "port", sPort }, |
{ "port", sPort }, |
{ "hostkey", sHostKeyFile }, |
{ "hostkey", sHostKeyFile }, |
{ "hostdsakey", sHostDSAKeyFile }, |
{ "hostdsakey", sHostKeyFile }, /* alias */ |
{ "pidfile", sPidFile }, |
{ "pidfile", sPidFile }, |
{ "serverkeybits", sServerKeyBits }, |
{ "serverkeybits", sServerKeyBits }, |
{ "logingracetime", sLoginGraceTime }, |
{ "logingracetime", sLoginGraceTime }, |
|
|
{ "rhostsauthentication", sRhostsAuthentication }, |
{ "rhostsauthentication", sRhostsAuthentication }, |
{ "rhostsrsaauthentication", sRhostsRSAAuthentication }, |
{ "rhostsrsaauthentication", sRhostsRSAAuthentication }, |
{ "rsaauthentication", sRSAAuthentication }, |
{ "rsaauthentication", sRSAAuthentication }, |
{ "dsaauthentication", sDSAAuthentication }, |
{ "pubkeyauthentication", sPubkeyAuthentication }, |
|
{ "dsaauthentication", sPubkeyAuthentication }, /* alias */ |
#ifdef KRB4 |
#ifdef KRB4 |
{ "kerberosauthentication", sKerberosAuthentication }, |
{ "kerberosauthentication", sKerberosAuthentication }, |
{ "kerberosorlocalpasswd", sKerberosOrLocalPasswd }, |
{ "kerberosorlocalpasswd", sKerberosOrLocalPasswd }, |
|
|
arg = strdelim(&cp); |
arg = strdelim(&cp); |
if (!*arg || *arg == '#') |
if (!*arg || *arg == '#') |
continue; |
continue; |
|
intptr = NULL; |
|
charptr = NULL; |
opcode = parse_token(arg, filename, linenum); |
opcode = parse_token(arg, filename, linenum); |
switch (opcode) { |
switch (opcode) { |
case sBadOption: |
case sBadOption: |
|
|
break; |
break; |
|
|
case sHostKeyFile: |
case sHostKeyFile: |
case sHostDSAKeyFile: |
intptr = &options->num_host_key_files; |
charptr = (opcode == sHostKeyFile ) ? |
if (*intptr >= MAX_HOSTKEYS) { |
&options->host_key_file : &options->host_dsa_key_file; |
fprintf(stderr, "%s line %d: to many host keys specified (max %d).\n", |
|
filename, linenum, MAX_HOSTKEYS); |
|
exit(1); |
|
} |
|
charptr = &options->host_key_files[*intptr]; |
parse_filename: |
parse_filename: |
arg = strdelim(&cp); |
arg = strdelim(&cp); |
if (!arg || *arg == '\0') { |
if (!arg || *arg == '\0') { |
|
|
filename, linenum); |
filename, linenum); |
exit(1); |
exit(1); |
} |
} |
if (*charptr == NULL) |
if (*charptr == NULL) { |
*charptr = tilde_expand_filename(arg, getuid()); |
*charptr = tilde_expand_filename(arg, getuid()); |
|
/* increase optional counter */ |
|
if (intptr != NULL) |
|
*intptr = *intptr + 1; |
|
} |
break; |
break; |
|
|
case sPidFile: |
case sPidFile: |
|
|
intptr = &options->rsa_authentication; |
intptr = &options->rsa_authentication; |
goto parse_flag; |
goto parse_flag; |
|
|
case sDSAAuthentication: |
case sPubkeyAuthentication: |
intptr = &options->dsa_authentication; |
intptr = &options->pubkey_authentication; |
goto parse_flag; |
goto parse_flag; |
|
|
#ifdef KRB4 |
#ifdef KRB4 |