summaryrefslogtreecommitdiff
path: root/servconf.c
diff options
context:
space:
mode:
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 b1e52638c..f6d063989 100644
--- a/servconf.c
+++ b/servconf.c
@@ -12,7 +12,7 @@ Created: Mon Aug 21 15:48:58 1995 ylo
12*/ 12*/
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$Id: servconf.c,v 1.3 1999/11/12 00:33:04 damien Exp $"); 15RCSID("$Id: servconf.c,v 1.4 1999/11/12 04:19:27 damien Exp $");
16 16
17#include "ssh.h" 17#include "ssh.h"
18#include "servconf.h" 18#include "servconf.h"
@@ -144,6 +144,7 @@ void fill_default_server_options(ServerOptions *options)
144/* Keyword tokens. */ 144/* Keyword tokens. */
145typedef enum 145typedef enum
146{ 146{
147 sBadOption, /* == unknown option */
147 sPort, sHostKeyFile, sServerKeyBits, sLoginGraceTime, sKeyRegenerationTime, 148 sPort, sHostKeyFile, sServerKeyBits, sLoginGraceTime, sKeyRegenerationTime,
148 sPermitRootLogin, sLogFacility, sLogLevel, 149 sPermitRootLogin, sLogFacility, sLogLevel,
149 sRhostsAuthentication, sRhostsRSAAuthentication, sRSAAuthentication, 150 sRhostsAuthentication, sRhostsRSAAuthentication, sRSAAuthentication,
@@ -260,9 +261,9 @@ static ServerOpCodes parse_token(const char *cp, const char *filename,
260 if (strcmp(cp, keywords[i].name) == 0) 261 if (strcmp(cp, keywords[i].name) == 0)
261 return keywords[i].opcode; 262 return keywords[i].opcode;
262 263
263 fprintf(stderr, "%s line %d: Bad configuration option: %s\n", 264 fprintf(stderr, "%s: line %d: Bad configuration option: %s\n",
264 filename, linenum, cp); 265 filename, linenum, cp);
265 exit(1); 266 return sBadOption;
266} 267}
267 268
268/* Reads the server configuration file. */ 269/* Reads the server configuration file. */
@@ -273,6 +274,7 @@ void read_server_config(ServerOptions *options, const char *filename)
273 char line[1024]; 274 char line[1024];
274 char *cp, **charptr; 275 char *cp, **charptr;
275 int linenum, *intptr, i, value; 276 int linenum, *intptr, i, value;
277 int bad_options = 0;
276 ServerOpCodes opcode; 278 ServerOpCodes opcode;
277 279
278 f = fopen(filename, "r"); 280 f = fopen(filename, "r");
@@ -300,6 +302,9 @@ void read_server_config(ServerOptions *options, const char *filename)
300 opcode = parse_token(cp, filename, linenum); 302 opcode = parse_token(cp, filename, linenum);
301 switch (opcode) 303 switch (opcode)
302 { 304 {
305 case sBadOption:
306 bad_options++;
307 continue;
303 case sPort: 308 case sPort:
304 intptr = &options->port; 309 intptr = &options->port;
305 parse_int: 310 parse_int:
@@ -596,4 +601,9 @@ void read_server_config(ServerOptions *options, const char *filename)
596 } 601 }
597 } 602 }
598 fclose(f); 603 fclose(f);
604 if (bad_options > 0) {
605 fprintf(stderr, "%s: terminating, %d bad configuration options\n",
606 filename, bad_options);
607 exit(1);
608 }
599} 609}