diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 1999-11-11 23:26:54 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 1999-11-11 23:26:54 +0000 |
commit | 7eeb2cbc8ec1be7ada2e8f1c8373e1b6e46bb468 (patch) | |
tree | b0eeee5d4c80d19a78b95acee9598870b722ec65 /usr.bin | |
parent | 60d81ea24be4e04ee33496f2cb2e3f96f8ae2c32 (diff) |
print _all_ bad options found in configfile
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/servconf.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.bin/ssh/servconf.c b/usr.bin/ssh/servconf.c index 97dd45049e9..cf5368c7510 100644 --- a/usr.bin/ssh/servconf.c +++ b/usr.bin/ssh/servconf.c @@ -12,7 +12,7 @@ Created: Mon Aug 21 15:48:58 1995 ylo */ #include "includes.h" -RCSID("$Id: servconf.c,v 1.21 1999/11/11 22:58:38 markus Exp $"); +RCSID("$Id: servconf.c,v 1.22 1999/11/11 23:26:53 markus Exp $"); #include "ssh.h" #include "servconf.h" @@ -144,6 +144,7 @@ void fill_default_server_options(ServerOptions *options) /* Keyword tokens. */ typedef enum { + sBadOption, /* == unknown option */ sPort, sHostKeyFile, sServerKeyBits, sLoginGraceTime, sKeyRegenerationTime, sPermitRootLogin, sLogFacility, sLogLevel, sRhostsAuthentication, sRhostsRSAAuthentication, sRSAAuthentication, @@ -260,9 +261,9 @@ static ServerOpCodes parse_token(const char *cp, const char *filename, if (strcmp(cp, keywords[i].name) == 0) 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); - exit(1); + return sBadOption; } /* Reads the server configuration file. */ @@ -273,6 +274,7 @@ void read_server_config(ServerOptions *options, const char *filename) char line[1024]; char *cp, **charptr; int linenum, *intptr, i, value; + int bad_options = 0; ServerOpCodes opcode; f = fopen(filename, "r"); @@ -300,6 +302,9 @@ void read_server_config(ServerOptions *options, const char *filename) opcode = parse_token(cp, filename, linenum); switch (opcode) { + case sBadOption: + bad_options++; + continue; case sPort: intptr = &options->port; parse_int: @@ -596,4 +601,9 @@ void read_server_config(ServerOptions *options, const char *filename) } } fclose(f); + if (bad_options > 0) { + fprintf(stderr, "%s: terminating, %d bad configuration options\n", + filename, bad_options); + exit(1); + } } |