version 1.21, 1999/11/11 22:58:38 |
version 1.22, 1999/11/11 23:26:53 |
|
|
/* Keyword tokens. */ |
/* Keyword tokens. */ |
typedef enum |
typedef enum |
{ |
{ |
|
sBadOption, /* == unknown option */ |
sPort, sHostKeyFile, sServerKeyBits, sLoginGraceTime, sKeyRegenerationTime, |
sPort, sHostKeyFile, sServerKeyBits, sLoginGraceTime, sKeyRegenerationTime, |
sPermitRootLogin, sLogFacility, sLogLevel, |
sPermitRootLogin, sLogFacility, sLogLevel, |
sRhostsAuthentication, sRhostsRSAAuthentication, sRSAAuthentication, |
sRhostsAuthentication, sRhostsRSAAuthentication, sRSAAuthentication, |
|
|
if (strcmp(cp, keywords[i].name) == 0) |
if (strcmp(cp, keywords[i].name) == 0) |
return keywords[i].opcode; |
return keywords[i].opcode; |
|
|
fprintf(stderr, "%s line %d: Bad configuration option: %s\n", |
fprintf(stderr, "%s: line %d: Bad configuration option: %s\n", |
filename, linenum, cp); |
filename, linenum, cp); |
exit(1); |
return sBadOption; |
} |
} |
|
|
/* Reads the server configuration file. */ |
/* Reads the server configuration file. */ |
|
|
char line[1024]; |
char line[1024]; |
char *cp, **charptr; |
char *cp, **charptr; |
int linenum, *intptr, i, value; |
int linenum, *intptr, i, value; |
|
int bad_options = 0; |
ServerOpCodes opcode; |
ServerOpCodes opcode; |
|
|
f = fopen(filename, "r"); |
f = fopen(filename, "r"); |
|
|
opcode = parse_token(cp, filename, linenum); |
opcode = parse_token(cp, filename, linenum); |
switch (opcode) |
switch (opcode) |
{ |
{ |
|
case sBadOption: |
|
bad_options++; |
|
continue; |
case sPort: |
case sPort: |
intptr = &options->port; |
intptr = &options->port; |
parse_int: |
parse_int: |
|
|
} |
} |
} |
} |
fclose(f); |
fclose(f); |
|
if (bad_options > 0) { |
|
fprintf(stderr, "%s: terminating, %d bad configuration options\n", |
|
filename, bad_options); |
|
exit(1); |
|
} |
} |
} |