summaryrefslogtreecommitdiff
path: root/servconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'servconf.c')
-rw-r--r--servconf.c81
1 files changed, 31 insertions, 50 deletions
diff --git a/servconf.c b/servconf.c
index f978c632b..3d0c9efa6 100644
--- a/servconf.c
+++ b/servconf.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include "includes.h" 12#include "includes.h"
13RCSID("$OpenBSD: servconf.c,v 1.77 2001/04/13 22:46:53 beck Exp $"); 13RCSID("$OpenBSD: servconf.c,v 1.78 2001/04/15 21:28:35 stevesk Exp $");
14 14
15#ifdef KRB4 15#ifdef KRB4
16#include <krb.h> 16#include <krb.h>
@@ -315,8 +315,8 @@ parse_token(const char *cp, const char *filename,
315 if (strcasecmp(cp, keywords[i].name) == 0) 315 if (strcasecmp(cp, keywords[i].name) == 0)
316 return keywords[i].opcode; 316 return keywords[i].opcode;
317 317
318 fprintf(stderr, "%s: line %d: Bad configuration option: %s\n", 318 error("%s: line %d: Bad configuration option: %s",
319 filename, linenum, cp); 319 filename, linenum, cp);
320 return sBadOption; 320 return sBadOption;
321} 321}
322 322
@@ -415,11 +415,9 @@ read_server_config(ServerOptions *options, const char *filename)
415 intptr = &options->server_key_bits; 415 intptr = &options->server_key_bits;
416parse_int: 416parse_int:
417 arg = strdelim(&cp); 417 arg = strdelim(&cp);
418 if (!arg || *arg == '\0') { 418 if (!arg || *arg == '\0')
419 fprintf(stderr, "%s line %d: missing integer value.\n", 419 fatal("%s line %d: missing integer value.",
420 filename, linenum); 420 filename, linenum);
421 exit(1);
422 }
423 value = atoi(arg); 421 value = atoi(arg);
424 if (*intptr == -1) 422 if (*intptr == -1)
425 *intptr = value; 423 *intptr = value;
@@ -472,20 +470,15 @@ parse_int:
472 470
473 case sHostKeyFile: 471 case sHostKeyFile:
474 intptr = &options->num_host_key_files; 472 intptr = &options->num_host_key_files;
475 if (*intptr >= MAX_HOSTKEYS) { 473 if (*intptr >= MAX_HOSTKEYS)
476 fprintf(stderr, 474 fatal("%s line %d: too many host keys specified (max %d).",
477 "%s line %d: too many host keys specified (max %d).\n",
478 filename, linenum, MAX_HOSTKEYS); 475 filename, linenum, MAX_HOSTKEYS);
479 exit(1);
480 }
481 charptr = &options->host_key_files[*intptr]; 476 charptr = &options->host_key_files[*intptr];
482parse_filename: 477parse_filename:
483 arg = strdelim(&cp); 478 arg = strdelim(&cp);
484 if (!arg || *arg == '\0') { 479 if (!arg || *arg == '\0')
485 fprintf(stderr, "%s line %d: missing file name.\n", 480 fatal("%s line %d: missing file name.",
486 filename, linenum); 481 filename, linenum);
487 exit(1);
488 }
489 if (*charptr == NULL) { 482 if (*charptr == NULL) {
490 *charptr = tilde_expand_filename(arg, getuid()); 483 *charptr = tilde_expand_filename(arg, getuid());
491 /* increase optional counter */ 484 /* increase optional counter */
@@ -501,12 +494,11 @@ parse_filename:
501 case sPermitRootLogin: 494 case sPermitRootLogin:
502 intptr = &options->permit_root_login; 495 intptr = &options->permit_root_login;
503 arg = strdelim(&cp); 496 arg = strdelim(&cp);
504 if (!arg || *arg == '\0') { 497 if (!arg || *arg == '\0')
505 fprintf(stderr, "%s line %d: missing yes/" 498 fatal("%s line %d: missing yes/"
506 "without-password/forced-commands-only/no " 499 "without-password/forced-commands-only/no "
507 "argument.\n", filename, linenum); 500 "argument.", filename, linenum);
508 exit(1); 501 value = 0; /* silence compiler */
509 }
510 if (strcmp(arg, "without-password") == 0) 502 if (strcmp(arg, "without-password") == 0)
511 value = PERMIT_NO_PASSWD; 503 value = PERMIT_NO_PASSWD;
512 else if (strcmp(arg, "forced-commands-only") == 0) 504 else if (strcmp(arg, "forced-commands-only") == 0)
@@ -515,12 +507,10 @@ parse_filename:
515 value = PERMIT_YES; 507 value = PERMIT_YES;
516 else if (strcmp(arg, "no") == 0) 508 else if (strcmp(arg, "no") == 0)
517 value = PERMIT_NO; 509 value = PERMIT_NO;
518 else { 510 else
519 fprintf(stderr, "%s line %d: Bad yes/" 511 fatal("%s line %d: Bad yes/"
520 "without-password/forced-commands-only/no " 512 "without-password/forced-commands-only/no "
521 "argument: %s\n", filename, linenum, arg); 513 "argument: %s", filename, linenum, arg);
522 exit(1);
523 }
524 if (*intptr == -1) 514 if (*intptr == -1)
525 *intptr = value; 515 *intptr = value;
526 break; 516 break;
@@ -529,20 +519,17 @@ parse_filename:
529 intptr = &options->ignore_rhosts; 519 intptr = &options->ignore_rhosts;
530parse_flag: 520parse_flag:
531 arg = strdelim(&cp); 521 arg = strdelim(&cp);
532 if (!arg || *arg == '\0') { 522 if (!arg || *arg == '\0')
533 fprintf(stderr, "%s line %d: missing yes/no argument.\n", 523 fatal("%s line %d: missing yes/no argument.",
534 filename, linenum); 524 filename, linenum);
535 exit(1); 525 value = 0; /* silence compiler */
536 }
537 if (strcmp(arg, "yes") == 0) 526 if (strcmp(arg, "yes") == 0)
538 value = 1; 527 value = 1;
539 else if (strcmp(arg, "no") == 0) 528 else if (strcmp(arg, "no") == 0)
540 value = 0; 529 value = 0;
541 else { 530 else
542 fprintf(stderr, "%s line %d: Bad yes/no argument: %s\n", 531 fatal("%s line %d: Bad yes/no argument: %s",
543 filename, linenum, arg); 532 filename, linenum, arg);
544 exit(1);
545 }
546 if (*intptr == -1) 533 if (*intptr == -1)
547 *intptr = value; 534 *intptr = value;
548 break; 535 break;
@@ -808,21 +795,15 @@ parse_flag:
808 intptr = &options->client_alive_count_max; 795 intptr = &options->client_alive_count_max;
809 goto parse_int; 796 goto parse_int;
810 default: 797 default:
811 fprintf(stderr, "%s line %d: Missing handler for opcode %s (%d)\n", 798 fatal("%s line %d: Missing handler for opcode %s (%d)",
812 filename, linenum, arg, opcode); 799 filename, linenum, arg, opcode);
813 exit(1);
814 }
815 if ((arg = strdelim(&cp)) != NULL && *arg != '\0') {
816 fprintf(stderr,
817 "%s line %d: garbage at end of line; \"%.200s\".\n",
818 filename, linenum, arg);
819 exit(1);
820 } 800 }
801 if ((arg = strdelim(&cp)) != NULL && *arg != '\0')
802 fatal("%s line %d: garbage at end of line; \"%.200s\".",
803 filename, linenum, arg);
821 } 804 }
822 fclose(f); 805 fclose(f);
823 if (bad_options > 0) { 806 if (bad_options > 0)
824 fprintf(stderr, "%s: terminating, %d bad configuration options\n", 807 fatal("%s: terminating, %d bad configuration options",
825 filename, bad_options); 808 filename, bad_options);
826 exit(1);
827 }
828} 809}