version 1.32, 2000/04/06 08:55:22 |
version 1.33, 2000/04/12 07:45:44 |
|
|
#include "ssh.h" |
#include "ssh.h" |
#include "servconf.h" |
#include "servconf.h" |
#include "xmalloc.h" |
#include "xmalloc.h" |
|
#include "compat.h" |
|
|
/* add listen address */ |
/* add listen address */ |
void add_listen_addr(ServerOptions *options, char *addr); |
void add_listen_addr(ServerOptions *options, char *addr); |
|
|
options->num_deny_users = 0; |
options->num_deny_users = 0; |
options->num_allow_groups = 0; |
options->num_allow_groups = 0; |
options->num_deny_groups = 0; |
options->num_deny_groups = 0; |
|
options->ciphers = NULL; |
|
options->protocol = SSH_PROTO_UNKNOWN; |
} |
} |
|
|
void |
void |
|
|
options->permit_empty_passwd = 0; |
options->permit_empty_passwd = 0; |
if (options->use_login == -1) |
if (options->use_login == -1) |
options->use_login = 0; |
options->use_login = 0; |
|
if (options->protocol == SSH_PROTO_UNKNOWN) |
|
options->protocol = SSH_PROTO_1; |
} |
} |
|
|
#define WHITESPACE " \t\r\n" |
#define WHITESPACE " \t\r\n" |
|
|
sPrintMotd, sIgnoreRhosts, sX11Forwarding, sX11DisplayOffset, |
sPrintMotd, sIgnoreRhosts, sX11Forwarding, sX11DisplayOffset, |
sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives, sCheckMail, |
sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives, sCheckMail, |
sUseLogin, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups, |
sUseLogin, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups, |
sIgnoreUserKnownHosts, sDSAKeyFile |
sIgnoreUserKnownHosts, sDSAKeyFile, sCiphers, sProtocol |
} ServerOpCodes; |
} ServerOpCodes; |
|
|
/* Textual representation of the tokens. */ |
/* Textual representation of the tokens. */ |
|
|
{ "denyusers", sDenyUsers }, |
{ "denyusers", sDenyUsers }, |
{ "allowgroups", sAllowGroups }, |
{ "allowgroups", sAllowGroups }, |
{ "denygroups", sDenyGroups }, |
{ "denygroups", sDenyGroups }, |
|
{ "ciphers", sCiphers }, |
|
{ "protocol", sProtocol }, |
{ NULL, 0 } |
{ NULL, 0 } |
}; |
}; |
|
|
|
|
value = log_facility_number(cp); |
value = log_facility_number(cp); |
if (value == (SyslogFacility) - 1) |
if (value == (SyslogFacility) - 1) |
fatal("%.200s line %d: unsupported log facility '%s'\n", |
fatal("%.200s line %d: unsupported log facility '%s'\n", |
filename, linenum, cp ? cp : "<NONE>"); |
filename, linenum, cp ? cp : "<NONE>"); |
if (*intptr == -1) |
if (*intptr == -1) |
*intptr = (SyslogFacility) value; |
*intptr = (SyslogFacility) value; |
break; |
break; |
|
|
value = log_level_number(cp); |
value = log_level_number(cp); |
if (value == (LogLevel) - 1) |
if (value == (LogLevel) - 1) |
fatal("%.200s line %d: unsupported log level '%s'\n", |
fatal("%.200s line %d: unsupported log level '%s'\n", |
filename, linenum, cp ? cp : "<NONE>"); |
filename, linenum, cp ? cp : "<NONE>"); |
if (*intptr == -1) |
if (*intptr == -1) |
*intptr = (LogLevel) value; |
*intptr = (LogLevel) value; |
break; |
break; |
|
|
case sAllowUsers: |
case sAllowUsers: |
while ((cp = strtok(NULL, WHITESPACE))) { |
while ((cp = strtok(NULL, WHITESPACE))) { |
if (options->num_allow_users >= MAX_ALLOW_USERS) { |
if (options->num_allow_users >= MAX_ALLOW_USERS) |
fprintf(stderr, "%s line %d: too many allow users.\n", |
fatal("%s line %d: too many allow users.\n", |
filename, linenum); |
filename, linenum); |
exit(1); |
|
} |
|
options->allow_users[options->num_allow_users++] = xstrdup(cp); |
options->allow_users[options->num_allow_users++] = xstrdup(cp); |
} |
} |
break; |
break; |
|
|
case sDenyUsers: |
case sDenyUsers: |
while ((cp = strtok(NULL, WHITESPACE))) { |
while ((cp = strtok(NULL, WHITESPACE))) { |
if (options->num_deny_users >= MAX_DENY_USERS) { |
if (options->num_deny_users >= MAX_DENY_USERS) |
fprintf(stderr, "%s line %d: too many deny users.\n", |
fatal( "%s line %d: too many deny users.\n", |
filename, linenum); |
filename, linenum); |
exit(1); |
|
} |
|
options->deny_users[options->num_deny_users++] = xstrdup(cp); |
options->deny_users[options->num_deny_users++] = xstrdup(cp); |
} |
} |
break; |
break; |
|
|
case sAllowGroups: |
case sAllowGroups: |
while ((cp = strtok(NULL, WHITESPACE))) { |
while ((cp = strtok(NULL, WHITESPACE))) { |
if (options->num_allow_groups >= MAX_ALLOW_GROUPS) { |
if (options->num_allow_groups >= MAX_ALLOW_GROUPS) |
fprintf(stderr, "%s line %d: too many allow groups.\n", |
fatal("%s line %d: too many allow groups.\n", |
filename, linenum); |
filename, linenum); |
exit(1); |
|
} |
|
options->allow_groups[options->num_allow_groups++] = xstrdup(cp); |
options->allow_groups[options->num_allow_groups++] = xstrdup(cp); |
} |
} |
break; |
break; |
|
|
case sDenyGroups: |
case sDenyGroups: |
while ((cp = strtok(NULL, WHITESPACE))) { |
while ((cp = strtok(NULL, WHITESPACE))) { |
if (options->num_deny_groups >= MAX_DENY_GROUPS) { |
if (options->num_deny_groups >= MAX_DENY_GROUPS) |
fprintf(stderr, "%s line %d: too many deny groups.\n", |
fatal("%s line %d: too many deny groups.\n", |
filename, linenum); |
filename, linenum); |
exit(1); |
|
} |
|
options->deny_groups[options->num_deny_groups++] = xstrdup(cp); |
options->deny_groups[options->num_deny_groups++] = xstrdup(cp); |
} |
} |
|
break; |
|
|
|
case sCiphers: |
|
cp = strtok(NULL, WHITESPACE); |
|
if (!ciphers_valid(cp)) |
|
fatal("%s line %d: Bad cipher spec '%s'.", |
|
filename, linenum, cp ? cp : "<NONE>"); |
|
if (options->ciphers == NULL) |
|
options->ciphers = xstrdup(cp); |
|
break; |
|
|
|
case sProtocol: |
|
intptr = &options->protocol; |
|
cp = strtok(NULL, WHITESPACE); |
|
value = proto_spec(cp); |
|
if (value == SSH_PROTO_UNKNOWN) |
|
fatal("%s line %d: Bad protocol spec '%s'.", |
|
filename, linenum, cp ? cp : "<NONE>"); |
|
if (*intptr == SSH_PROTO_UNKNOWN) |
|
*intptr = value; |
break; |
break; |
|
|
default: |
default: |