blob: aa7d5b7817e07d3eae168e1d863936b1e66614fa [file] [log] [blame]
Damien Millerd4a8b7e1999-10-27 13:42:43 +10001/*
Damien Miller95def091999-11-25 00:26:21 +11002 *
3 * servconf.c
4 *
5 * Author: Tatu Ylonen <ylo@cs.hut.fi>
6 *
7 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
8 * All rights reserved
9 *
10 * Created: Mon Aug 21 15:48:58 1995 ylo
11 *
12 */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100013
14#include "includes.h"
Damien Miller95def091999-11-25 00:26:21 +110015RCSID("$Id: servconf.c,v 1.6 1999/11/24 13:26:22 damien Exp $");
Damien Millerd4a8b7e1999-10-27 13:42:43 +100016
17#include "ssh.h"
18#include "servconf.h"
19#include "xmalloc.h"
20
21/* Initializes the server options to their default values. */
22
Damien Miller95def091999-11-25 00:26:21 +110023void
24initialize_server_options(ServerOptions *options)
Damien Millerd4a8b7e1999-10-27 13:42:43 +100025{
Damien Miller95def091999-11-25 00:26:21 +110026 memset(options, 0, sizeof(*options));
27 options->port = -1;
28 options->listen_addr.s_addr = htonl(INADDR_ANY);
29 options->host_key_file = NULL;
30 options->server_key_bits = -1;
31 options->login_grace_time = -1;
32 options->key_regeneration_time = -1;
33 options->permit_root_login = -1;
34 options->ignore_rhosts = -1;
35 options->ignore_user_known_hosts = -1;
36 options->print_motd = -1;
37 options->check_mail = -1;
38 options->x11_forwarding = -1;
39 options->x11_display_offset = -1;
40 options->strict_modes = -1;
41 options->keepalives = -1;
42 options->log_facility = (SyslogFacility) - 1;
43 options->log_level = (LogLevel) - 1;
44 options->rhosts_authentication = -1;
45 options->rhosts_rsa_authentication = -1;
46 options->rsa_authentication = -1;
Damien Millerd4a8b7e1999-10-27 13:42:43 +100047#ifdef KRB4
Damien Miller95def091999-11-25 00:26:21 +110048 options->kerberos_authentication = -1;
49 options->kerberos_or_local_passwd = -1;
50 options->kerberos_ticket_cleanup = -1;
Damien Millerd4a8b7e1999-10-27 13:42:43 +100051#endif
52#ifdef AFS
Damien Miller95def091999-11-25 00:26:21 +110053 options->kerberos_tgt_passing = -1;
54 options->afs_token_passing = -1;
Damien Millerd4a8b7e1999-10-27 13:42:43 +100055#endif
Damien Miller95def091999-11-25 00:26:21 +110056 options->password_authentication = -1;
Damien Millerd4a8b7e1999-10-27 13:42:43 +100057#ifdef SKEY
Damien Miller95def091999-11-25 00:26:21 +110058 options->skey_authentication = -1;
Damien Millerd4a8b7e1999-10-27 13:42:43 +100059#endif
Damien Miller95def091999-11-25 00:26:21 +110060 options->permit_empty_passwd = -1;
61 options->use_login = -1;
62 options->num_allow_users = 0;
63 options->num_deny_users = 0;
64 options->num_allow_groups = 0;
65 options->num_deny_groups = 0;
Damien Millerd4a8b7e1999-10-27 13:42:43 +100066}
67
Damien Miller95def091999-11-25 00:26:21 +110068void
69fill_default_server_options(ServerOptions *options)
Damien Millerd4a8b7e1999-10-27 13:42:43 +100070{
Damien Miller95def091999-11-25 00:26:21 +110071 if (options->port == -1) {
72 struct servent *sp;
Damien Millerd4a8b7e1999-10-27 13:42:43 +100073
Damien Miller95def091999-11-25 00:26:21 +110074 sp = getservbyname(SSH_SERVICE_NAME, "tcp");
75 if (sp)
76 options->port = ntohs(sp->s_port);
77 else
78 options->port = SSH_DEFAULT_PORT;
79 endservent();
80 }
81 if (options->host_key_file == NULL)
82 options->host_key_file = HOST_KEY_FILE;
83 if (options->server_key_bits == -1)
84 options->server_key_bits = 768;
85 if (options->login_grace_time == -1)
86 options->login_grace_time = 600;
87 if (options->key_regeneration_time == -1)
88 options->key_regeneration_time = 3600;
89 if (options->permit_root_login == -1)
90 options->permit_root_login = 1; /* yes */
91 if (options->ignore_rhosts == -1)
92 options->ignore_rhosts = 0;
93 if (options->ignore_user_known_hosts == -1)
94 options->ignore_user_known_hosts = 0;
95 if (options->check_mail == -1)
96 options->check_mail = 0;
97 if (options->print_motd == -1)
98 options->print_motd = 1;
99 if (options->x11_forwarding == -1)
100 options->x11_forwarding = 1;
101 if (options->x11_display_offset == -1)
102 options->x11_display_offset = 1;
103 if (options->strict_modes == -1)
104 options->strict_modes = 1;
105 if (options->keepalives == -1)
106 options->keepalives = 1;
107 if (options->log_facility == (SyslogFacility) (-1))
108 options->log_facility = SYSLOG_FACILITY_AUTH;
109 if (options->log_level == (LogLevel) (-1))
110 options->log_level = SYSLOG_LEVEL_INFO;
111 if (options->rhosts_authentication == -1)
112 options->rhosts_authentication = 0;
113 if (options->rhosts_rsa_authentication == -1)
114 options->rhosts_rsa_authentication = 1;
115 if (options->rsa_authentication == -1)
116 options->rsa_authentication = 1;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000117#ifdef KRB4
Damien Miller95def091999-11-25 00:26:21 +1100118 if (options->kerberos_authentication == -1)
119 options->kerberos_authentication = (access(KEYFILE, R_OK) == 0);
120 if (options->kerberos_or_local_passwd == -1)
121 options->kerberos_or_local_passwd = 1;
122 if (options->kerberos_ticket_cleanup == -1)
123 options->kerberos_ticket_cleanup = 1;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000124#endif /* KRB4 */
125#ifdef AFS
Damien Miller95def091999-11-25 00:26:21 +1100126 if (options->kerberos_tgt_passing == -1)
127 options->kerberos_tgt_passing = 0;
128 if (options->afs_token_passing == -1)
129 options->afs_token_passing = k_hasafs();
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000130#endif /* AFS */
Damien Miller95def091999-11-25 00:26:21 +1100131 if (options->password_authentication == -1)
132 options->password_authentication = 1;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000133#ifdef SKEY
Damien Miller95def091999-11-25 00:26:21 +1100134 if (options->skey_authentication == -1)
135 options->skey_authentication = 1;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000136#endif
Damien Miller95def091999-11-25 00:26:21 +1100137 if (options->permit_empty_passwd == -1)
138 options->permit_empty_passwd = 1;
139 if (options->use_login == -1)
140 options->use_login = 0;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000141}
142
143#define WHITESPACE " \t\r\n"
144
145/* Keyword tokens. */
Damien Miller95def091999-11-25 00:26:21 +1100146typedef enum {
147 sBadOption, /* == unknown option */
148 sPort, sHostKeyFile, sServerKeyBits, sLoginGraceTime, sKeyRegenerationTime,
149 sPermitRootLogin, sLogFacility, sLogLevel,
150 sRhostsAuthentication, sRhostsRSAAuthentication, sRSAAuthentication,
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000151#ifdef KRB4
Damien Miller95def091999-11-25 00:26:21 +1100152 sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup,
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000153#endif
154#ifdef AFS
Damien Miller95def091999-11-25 00:26:21 +1100155 sKerberosTgtPassing, sAFSTokenPassing,
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000156#endif
157#ifdef SKEY
Damien Miller95def091999-11-25 00:26:21 +1100158 sSkeyAuthentication,
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000159#endif
Damien Miller95def091999-11-25 00:26:21 +1100160 sPasswordAuthentication, sListenAddress,
161 sPrintMotd, sIgnoreRhosts, sX11Forwarding, sX11DisplayOffset,
162 sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives, sCheckMail,
163 sUseLogin, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups,
164 sIgnoreUserKnownHosts
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000165} ServerOpCodes;
166
167/* Textual representation of the tokens. */
Damien Miller95def091999-11-25 00:26:21 +1100168static struct {
169 const char *name;
170 ServerOpCodes opcode;
171} keywords[] = {
172 { "port", sPort },
173 { "hostkey", sHostKeyFile },
174 { "serverkeybits", sServerKeyBits },
175 { "logingracetime", sLoginGraceTime },
176 { "keyregenerationinterval", sKeyRegenerationTime },
177 { "permitrootlogin", sPermitRootLogin },
178 { "syslogfacility", sLogFacility },
179 { "loglevel", sLogLevel },
180 { "rhostsauthentication", sRhostsAuthentication },
181 { "rhostsrsaauthentication", sRhostsRSAAuthentication },
182 { "rsaauthentication", sRSAAuthentication },
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000183#ifdef KRB4
Damien Miller95def091999-11-25 00:26:21 +1100184 { "kerberosauthentication", sKerberosAuthentication },
185 { "kerberosorlocalpasswd", sKerberosOrLocalPasswd },
186 { "kerberosticketcleanup", sKerberosTicketCleanup },
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000187#endif
188#ifdef AFS
Damien Miller95def091999-11-25 00:26:21 +1100189 { "kerberostgtpassing", sKerberosTgtPassing },
190 { "afstokenpassing", sAFSTokenPassing },
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000191#endif
Damien Miller95def091999-11-25 00:26:21 +1100192 { "passwordauthentication", sPasswordAuthentication },
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000193#ifdef SKEY
Damien Miller95def091999-11-25 00:26:21 +1100194 { "skeyauthentication", sSkeyAuthentication },
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000195#endif
Damien Miller95def091999-11-25 00:26:21 +1100196 { "checkmail", sCheckMail },
197 { "listenaddress", sListenAddress },
198 { "printmotd", sPrintMotd },
199 { "ignorerhosts", sIgnoreRhosts },
200 { "ignoreuserknownhosts", sIgnoreUserKnownHosts },
201 { "x11forwarding", sX11Forwarding },
202 { "x11displayoffset", sX11DisplayOffset },
203 { "strictmodes", sStrictModes },
204 { "permitemptypasswords", sEmptyPasswd },
205 { "uselogin", sUseLogin },
206 { "randomseed", sRandomSeedFile },
207 { "keepalive", sKeepAlives },
208 { "allowusers", sAllowUsers },
209 { "denyusers", sDenyUsers },
210 { "allowgroups", sAllowGroups },
211 { "denygroups", sDenyGroups },
212 { NULL, 0 }
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000213};
214
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000215/* Returns the number of the token pointed to by cp of length len.
216 Never returns if the token is not known. */
217
Damien Miller95def091999-11-25 00:26:21 +1100218static ServerOpCodes
219parse_token(const char *cp, const char *filename,
220 int linenum)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000221{
Damien Miller95def091999-11-25 00:26:21 +1100222 unsigned int i;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000223
Damien Miller95def091999-11-25 00:26:21 +1100224 for (i = 0; keywords[i].name; i++)
225 if (strcmp(cp, keywords[i].name) == 0)
226 return keywords[i].opcode;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000227
Damien Miller95def091999-11-25 00:26:21 +1100228 fprintf(stderr, "%s: line %d: Bad configuration option: %s\n",
229 filename, linenum, cp);
230 return sBadOption;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000231}
232
233/* Reads the server configuration file. */
234
Damien Miller95def091999-11-25 00:26:21 +1100235void
236read_server_config(ServerOptions *options, const char *filename)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000237{
Damien Miller95def091999-11-25 00:26:21 +1100238 FILE *f;
239 char line[1024];
240 char *cp, **charptr;
241 int linenum, *intptr, value;
242 int bad_options = 0;
243 ServerOpCodes opcode;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000244
Damien Miller95def091999-11-25 00:26:21 +1100245 f = fopen(filename, "r");
246 if (!f) {
247 perror(filename);
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000248 exit(1);
Damien Miller95def091999-11-25 00:26:21 +1100249 }
250 linenum = 0;
251 while (fgets(line, sizeof(line), f)) {
252 linenum++;
253 cp = line + strspn(line, WHITESPACE);
254 if (!*cp || *cp == '#')
255 continue;
256 cp = strtok(cp, WHITESPACE);
257 {
258 char *t = cp;
259 for (; *t != 0; t++)
260 if ('A' <= *t && *t <= 'Z')
261 *t = *t - 'A' + 'a'; /* tolower */
Damien Miller32265091999-11-12 11:33:04 +1100262
Damien Miller95def091999-11-25 00:26:21 +1100263 }
264 opcode = parse_token(cp, filename, linenum);
265 switch (opcode) {
266 case sBadOption:
267 bad_options++;
268 continue;
269 case sPort:
270 intptr = &options->port;
271parse_int:
272 cp = strtok(NULL, WHITESPACE);
273 if (!cp) {
274 fprintf(stderr, "%s line %d: missing integer value.\n",
275 filename, linenum);
276 exit(1);
277 }
278 value = atoi(cp);
279 if (*intptr == -1)
280 *intptr = value;
281 break;
Damien Miller32265091999-11-12 11:33:04 +1100282
Damien Miller95def091999-11-25 00:26:21 +1100283 case sServerKeyBits:
284 intptr = &options->server_key_bits;
285 goto parse_int;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000286
Damien Miller95def091999-11-25 00:26:21 +1100287 case sLoginGraceTime:
288 intptr = &options->login_grace_time;
289 goto parse_int;
290
291 case sKeyRegenerationTime:
292 intptr = &options->key_regeneration_time;
293 goto parse_int;
294
295 case sListenAddress:
296 cp = strtok(NULL, WHITESPACE);
297 if (!cp) {
298 fprintf(stderr, "%s line %d: missing inet addr.\n",
299 filename, linenum);
300 exit(1);
301 }
302 options->listen_addr.s_addr = inet_addr(cp);
303 break;
304
305 case sHostKeyFile:
306 charptr = &options->host_key_file;
307 cp = strtok(NULL, WHITESPACE);
308 if (!cp) {
309 fprintf(stderr, "%s line %d: missing file name.\n",
310 filename, linenum);
311 exit(1);
312 }
313 if (*charptr == NULL)
314 *charptr = tilde_expand_filename(cp, getuid());
315 break;
316
317 case sRandomSeedFile:
318 fprintf(stderr, "%s line %d: \"randomseed\" option is obsolete.\n",
319 filename, linenum);
320 cp = strtok(NULL, WHITESPACE);
321 break;
322
323 case sPermitRootLogin:
324 intptr = &options->permit_root_login;
325 cp = strtok(NULL, WHITESPACE);
326 if (!cp) {
327 fprintf(stderr, "%s line %d: missing yes/without-password/no argument.\n",
328 filename, linenum);
329 exit(1);
330 }
331 if (strcmp(cp, "without-password") == 0)
332 value = 2;
333 else if (strcmp(cp, "yes") == 0)
334 value = 1;
335 else if (strcmp(cp, "no") == 0)
336 value = 0;
337 else {
338 fprintf(stderr, "%s line %d: Bad yes/without-password/no argument: %s\n",
339 filename, linenum, cp);
340 exit(1);
341 }
342 if (*intptr == -1)
343 *intptr = value;
344 break;
345
346 case sIgnoreRhosts:
347 intptr = &options->ignore_rhosts;
348parse_flag:
349 cp = strtok(NULL, WHITESPACE);
350 if (!cp) {
351 fprintf(stderr, "%s line %d: missing yes/no argument.\n",
352 filename, linenum);
353 exit(1);
354 }
355 if (strcmp(cp, "yes") == 0)
356 value = 1;
357 else if (strcmp(cp, "no") == 0)
358 value = 0;
359 else {
360 fprintf(stderr, "%s line %d: Bad yes/no argument: %s\n",
361 filename, linenum, cp);
362 exit(1);
363 }
364 if (*intptr == -1)
365 *intptr = value;
366 break;
367
368 case sIgnoreUserKnownHosts:
369 intptr = &options->ignore_user_known_hosts;
370 goto parse_int;
371
372 case sRhostsAuthentication:
373 intptr = &options->rhosts_authentication;
374 goto parse_flag;
375
376 case sRhostsRSAAuthentication:
377 intptr = &options->rhosts_rsa_authentication;
378 goto parse_flag;
379
380 case sRSAAuthentication:
381 intptr = &options->rsa_authentication;
382 goto parse_flag;
383
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000384#ifdef KRB4
Damien Miller95def091999-11-25 00:26:21 +1100385 case sKerberosAuthentication:
386 intptr = &options->kerberos_authentication;
387 goto parse_flag;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000388
Damien Miller95def091999-11-25 00:26:21 +1100389 case sKerberosOrLocalPasswd:
390 intptr = &options->kerberos_or_local_passwd;
391 goto parse_flag;
392
393 case sKerberosTicketCleanup:
394 intptr = &options->kerberos_ticket_cleanup;
395 goto parse_flag;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000396#endif
Damien Miller95def091999-11-25 00:26:21 +1100397
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000398#ifdef AFS
Damien Miller95def091999-11-25 00:26:21 +1100399 case sKerberosTgtPassing:
400 intptr = &options->kerberos_tgt_passing;
401 goto parse_flag;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000402
Damien Miller95def091999-11-25 00:26:21 +1100403 case sAFSTokenPassing:
404 intptr = &options->afs_token_passing;
405 goto parse_flag;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000406#endif
407
Damien Miller95def091999-11-25 00:26:21 +1100408 case sPasswordAuthentication:
409 intptr = &options->password_authentication;
410 goto parse_flag;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000411
Damien Miller95def091999-11-25 00:26:21 +1100412 case sCheckMail:
413 intptr = &options->check_mail;
414 goto parse_flag;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000415
416#ifdef SKEY
Damien Miller95def091999-11-25 00:26:21 +1100417 case sSkeyAuthentication:
418 intptr = &options->skey_authentication;
419 goto parse_flag;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000420#endif
421
Damien Miller95def091999-11-25 00:26:21 +1100422 case sPrintMotd:
423 intptr = &options->print_motd;
424 goto parse_flag;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000425
Damien Miller95def091999-11-25 00:26:21 +1100426 case sX11Forwarding:
427 intptr = &options->x11_forwarding;
428 goto parse_flag;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000429
Damien Miller95def091999-11-25 00:26:21 +1100430 case sX11DisplayOffset:
431 intptr = &options->x11_display_offset;
432 goto parse_int;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000433
Damien Miller95def091999-11-25 00:26:21 +1100434 case sStrictModes:
435 intptr = &options->strict_modes;
436 goto parse_flag;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000437
Damien Miller95def091999-11-25 00:26:21 +1100438 case sKeepAlives:
439 intptr = &options->keepalives;
440 goto parse_flag;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000441
Damien Miller95def091999-11-25 00:26:21 +1100442 case sEmptyPasswd:
443 intptr = &options->permit_empty_passwd;
444 goto parse_flag;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000445
Damien Miller95def091999-11-25 00:26:21 +1100446 case sUseLogin:
447 intptr = &options->use_login;
448 goto parse_flag;
Damien Miller5ce662a1999-11-11 17:57:39 +1100449
Damien Miller95def091999-11-25 00:26:21 +1100450 case sLogFacility:
451 intptr = (int *) &options->log_facility;
452 cp = strtok(NULL, WHITESPACE);
453 value = log_facility_number(cp);
454 if (value == (SyslogFacility) - 1)
455 fatal("%.200s line %d: unsupported log facility '%s'\n",
456 filename, linenum, cp ? cp : "<NONE>");
457 if (*intptr == -1)
458 *intptr = (SyslogFacility) value;
459 break;
460
461 case sLogLevel:
462 intptr = (int *) &options->log_level;
463 cp = strtok(NULL, WHITESPACE);
464 value = log_level_number(cp);
465 if (value == (LogLevel) - 1)
466 fatal("%.200s line %d: unsupported log level '%s'\n",
467 filename, linenum, cp ? cp : "<NONE>");
468 if (*intptr == -1)
469 *intptr = (LogLevel) value;
470 break;
471
472 case sAllowUsers:
473 while ((cp = strtok(NULL, WHITESPACE))) {
474 if (options->num_allow_users >= MAX_ALLOW_USERS) {
475 fprintf(stderr, "%s line %d: too many allow users.\n",
476 filename, linenum);
477 exit(1);
478 }
479 options->allow_users[options->num_allow_users++] = xstrdup(cp);
480 }
481 break;
482
483 case sDenyUsers:
484 while ((cp = strtok(NULL, WHITESPACE))) {
485 if (options->num_deny_users >= MAX_DENY_USERS) {
486 fprintf(stderr, "%s line %d: too many deny users.\n",
487 filename, linenum);
488 exit(1);
489 }
490 options->deny_users[options->num_deny_users++] = xstrdup(cp);
491 }
492 break;
493
494 case sAllowGroups:
495 while ((cp = strtok(NULL, WHITESPACE))) {
496 if (options->num_allow_groups >= MAX_ALLOW_GROUPS) {
497 fprintf(stderr, "%s line %d: too many allow groups.\n",
498 filename, linenum);
499 exit(1);
500 }
501 options->allow_groups[options->num_allow_groups++] = xstrdup(cp);
502 }
503 break;
504
505 case sDenyGroups:
506 while ((cp = strtok(NULL, WHITESPACE))) {
507 if (options->num_deny_groups >= MAX_DENY_GROUPS) {
508 fprintf(stderr, "%s line %d: too many deny groups.\n",
509 filename, linenum);
510 exit(1);
511 }
512 options->deny_groups[options->num_deny_groups++] = xstrdup(cp);
513 }
514 break;
515
516 default:
517 fprintf(stderr, "%s line %d: Missing handler for opcode %s (%d)\n",
518 filename, linenum, cp, opcode);
519 exit(1);
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000520 }
Damien Miller95def091999-11-25 00:26:21 +1100521 if (strtok(NULL, WHITESPACE) != NULL) {
522 fprintf(stderr, "%s line %d: garbage at end of line.\n",
523 filename, linenum);
524 exit(1);
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000525 }
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000526 }
Damien Miller95def091999-11-25 00:26:21 +1100527 fclose(f);
528 if (bad_options > 0) {
529 fprintf(stderr, "%s: terminating, %d bad configuration options\n",
530 filename, bad_options);
531 exit(1);
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000532 }
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000533}