diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-04-16 02:13:26 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-04-16 02:13:26 +0000 |
commit | b5cdc6643848d170156770821ce946dae0d3f844 (patch) | |
tree | 17aff41d900612f590ce0fe3c30e98f7186ffbaf | |
parent | bdc2beb678f89823097a75c438d7a08f0963eb3e (diff) |
- stevesk@cvs.openbsd.org 2001/04/15 21:28:35
[readconf.c servconf.c]
use fatal() or error() vs. fprintf(); ok markus@
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | readconf.c | 6 | ||||
-rw-r--r-- | servconf.c | 81 |
3 files changed, 38 insertions, 54 deletions
@@ -16,6 +16,9 @@ | |||
16 | - stevesk@cvs.openbsd.org 2001/04/15 19:41:21 | 16 | - stevesk@cvs.openbsd.org 2001/04/15 19:41:21 |
17 | [sshd.8] | 17 | [sshd.8] |
18 | some ClientAlive cleanup; ok markus@ | 18 | some ClientAlive cleanup; ok markus@ |
19 | - stevesk@cvs.openbsd.org 2001/04/15 21:28:35 | ||
20 | [readconf.c servconf.c] | ||
21 | use fatal() or error() vs. fprintf(); ok markus@ | ||
19 | - (djm) Convert mandoc manpages to man automatically. Patch from Mark D. | 22 | - (djm) Convert mandoc manpages to man automatically. Patch from Mark D. |
20 | Roth <roth+openssh@feep.net> | 23 | Roth <roth+openssh@feep.net> |
21 | - (bal) CVS ID fix up and slight manpage fix from OpenBSD tree. | 24 | - (bal) CVS ID fix up and slight manpage fix from OpenBSD tree. |
@@ -5104,4 +5107,4 @@ | |||
5104 | - Wrote replacements for strlcpy and mkdtemp | 5107 | - Wrote replacements for strlcpy and mkdtemp |
5105 | - Released 1.0pre1 | 5108 | - Released 1.0pre1 |
5106 | 5109 | ||
5107 | $Id: ChangeLog,v 1.1123 2001/04/16 02:11:52 mouring Exp $ | 5110 | $Id: ChangeLog,v 1.1124 2001/04/16 02:13:26 mouring Exp $ |
diff --git a/readconf.c b/readconf.c index 241185c65..a14d0a55d 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "includes.h" | 14 | #include "includes.h" |
15 | RCSID("$OpenBSD: readconf.c,v 1.74 2001/04/12 20:09:37 stevesk Exp $"); | 15 | RCSID("$OpenBSD: readconf.c,v 1.75 2001/04/15 21:28:35 stevesk Exp $"); |
16 | 16 | ||
17 | #include "ssh.h" | 17 | #include "ssh.h" |
18 | #include "xmalloc.h" | 18 | #include "xmalloc.h" |
@@ -233,8 +233,8 @@ parse_token(const char *cp, const char *filename, int linenum) | |||
233 | if (strcasecmp(cp, keywords[i].name) == 0) | 233 | if (strcasecmp(cp, keywords[i].name) == 0) |
234 | return keywords[i].opcode; | 234 | return keywords[i].opcode; |
235 | 235 | ||
236 | fprintf(stderr, "%s: line %d: Bad configuration option: %s\n", | 236 | error("%s: line %d: Bad configuration option: %s", |
237 | filename, linenum, cp); | 237 | filename, linenum, cp); |
238 | return oBadOption; | 238 | return oBadOption; |
239 | } | 239 | } |
240 | 240 | ||
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" |
13 | RCSID("$OpenBSD: servconf.c,v 1.77 2001/04/13 22:46:53 beck Exp $"); | 13 | RCSID("$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; |
416 | parse_int: | 416 | parse_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]; |
482 | parse_filename: | 477 | parse_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; |
530 | parse_flag: | 520 | parse_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 | } |