summaryrefslogtreecommitdiffstats
path: root/servconf.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>1999-11-12 15:19:27 +1100
committerDamien Miller <djm@mindrot.org>1999-11-12 15:19:27 +1100
commit6d7b2cd1a32efa2a40c97361065d357a2e60b716 (patch)
tree9c34abc2723760ce00b6f3867d7e0cfbd6a7424e /servconf.c
parentb5f8927a7e3f25cef4c66603a780176e1b9f6082 (diff)
- Merged yet more changes from OpenBSD CVS
- [auth-rh-rsa.c auth-rhosts.c auth-rsa.c channels.c clientloop.c] [ssh.c ssh.h sshconnect.c sshd.c] make all access to options via 'extern Options options' and 'extern ServerOptions options' respectively; options are no longer passed as arguments: * make options handling more consistent * remove #include "readconf.h" from ssh.h * readconf.h is only included if necessary - [mpaux.c] clear temp buffer - [servconf.c] print _all_ bad options found in configfile
Diffstat (limited to 'servconf.c')
-rw-r--r--servconf.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/servconf.c b/servconf.c
index b1e52638..f6d06398 100644
--- a/servconf.c
+++ b/servconf.c
@@ -12,7 +12,7 @@ Created: Mon Aug 21 15:48:58 1995 ylo
*/
#include "includes.h"
-RCSID("$Id: servconf.c,v 1.3 1999/11/12 00:33:04 damien Exp $");
+RCSID("$Id: servconf.c,v 1.4 1999/11/12 04:19:27 damien 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);
+ }
}