1 /* 2 * Copyright (c) 1983 Eric P. Allman 3 * Copyright (c) 1988 Regents of the University of California. 4 * All rights reserved. 5 * 6 * %sccs.include.redist.c% 7 */ 8 9 #ifndef lint 10 static char sccsid[] = "@(#)readcf.c 5.34 (Berkeley) 02/24/92"; 11 #endif /* not lint */ 12 13 # include "sendmail.h" 14 # include <sys/stat.h> 15 16 /* 17 ** READCF -- read control file. 18 ** 19 ** This routine reads the control file and builds the internal 20 ** form. 21 ** 22 ** The file is formatted as a sequence of lines, each taken 23 ** atomically. The first character of each line describes how 24 ** the line is to be interpreted. The lines are: 25 ** Dxval Define macro x to have value val. 26 ** Cxword Put word into class x. 27 ** Fxfile [fmt] Read file for lines to put into 28 ** class x. Use scanf string 'fmt' 29 ** or "%s" if not present. Fmt should 30 ** only produce one string-valued result. 31 ** Hname: value Define header with field-name 'name' 32 ** and value as specified; this will be 33 ** macro expanded immediately before 34 ** use. 35 ** Sn Use rewriting set n. 36 ** Rlhs rhs Rewrite addresses that match lhs to 37 ** be rhs. 38 ** Mn arg=val... Define mailer. n is the internal name. 39 ** Args specify mailer parameters. 40 ** Oxvalue Set option x to value. 41 ** Pname=value Set precedence name to value. 42 ** Vversioncode Version level of configuration syntax. 43 ** 44 ** Parameters: 45 ** cfname -- control file name. 46 ** 47 ** Returns: 48 ** none. 49 ** 50 ** Side Effects: 51 ** Builds several internal tables. 52 */ 53 54 readcf(cfname) 55 char *cfname; 56 { 57 FILE *cf; 58 int ruleset = 0; 59 char *q; 60 char **pv; 61 struct rewrite *rwp = NULL; 62 char buf[MAXLINE]; 63 register char *p; 64 extern char **prescan(); 65 extern char **copyplist(); 66 struct stat statb; 67 char exbuf[MAXLINE]; 68 char pvpbuf[PSBUFSIZE]; 69 extern char *fgetfolded(); 70 extern char *munchstring(); 71 72 FileName = cfname; 73 LineNumber = 0; 74 75 cf = fopen(cfname, "r"); 76 if (cf == NULL) 77 { 78 syserr("cannot open"); 79 exit(EX_OSFILE); 80 } 81 82 if (fstat(fileno(cf), &statb) < 0) 83 { 84 syserr("cannot fstat"); 85 exit(EX_OSFILE); 86 } 87 88 if (!S_ISREG(statb.st_mode)) 89 { 90 syserr("not a plain file"); 91 exit(EX_OSFILE); 92 } 93 94 if (OpMode != MD_TEST && bitset(S_IWGRP|S_IWOTH, statb.st_mode)) 95 { 96 syserr("WARNING: dangerous write permissions"); 97 } 98 99 while (fgetfolded(buf, sizeof buf, cf) != NULL) 100 { 101 if (buf[0] == '#') 102 continue; 103 104 /* map $ into \001 (ASCII SOH) for macro expansion */ 105 for (p = buf; *p != '\0'; p++) 106 { 107 if (*p == '#' && p > buf && ConfigLevel >= 3) 108 { 109 /* this is an on-line comment */ 110 register char *e; 111 112 switch (*--p) 113 { 114 case '\001': 115 /* it's from $# -- let it go through */ 116 p++; 117 break; 118 119 case '\\': 120 /* it's backslash escaped */ 121 (void) strcpy(p, p + 1); 122 break; 123 124 default: 125 /* delete preceeding white space */ 126 while (isspace(*p) && p > buf) 127 p--; 128 if ((e = index(++p, '\n')) != NULL) 129 (void) strcpy(p, e); 130 else 131 p[0] = p[1] = '\0'; 132 break; 133 } 134 continue; 135 } 136 137 if (*p != '$') 138 continue; 139 140 if (p[1] == '$') 141 { 142 /* actual dollar sign.... */ 143 (void) strcpy(p, p + 1); 144 continue; 145 } 146 147 /* convert to macro expansion character */ 148 *p = '\001'; 149 } 150 151 /* interpret this line */ 152 switch (buf[0]) 153 { 154 case '\0': 155 case '#': /* comment */ 156 break; 157 158 case 'R': /* rewriting rule */ 159 for (p = &buf[1]; *p != '\0' && *p != '\t'; p++) 160 continue; 161 162 if (*p == '\0') 163 { 164 syserr("invalid rewrite line \"%s\"", buf); 165 break; 166 } 167 168 /* allocate space for the rule header */ 169 if (rwp == NULL) 170 { 171 RewriteRules[ruleset] = rwp = 172 (struct rewrite *) xalloc(sizeof *rwp); 173 } 174 else 175 { 176 rwp->r_next = (struct rewrite *) xalloc(sizeof *rwp); 177 rwp = rwp->r_next; 178 } 179 rwp->r_next = NULL; 180 181 /* expand and save the LHS */ 182 *p = '\0'; 183 expand(&buf[1], exbuf, &exbuf[sizeof exbuf], CurEnv); 184 rwp->r_lhs = prescan(exbuf, '\t', pvpbuf); 185 if (rwp->r_lhs != NULL) 186 rwp->r_lhs = copyplist(rwp->r_lhs, TRUE); 187 188 /* expand and save the RHS */ 189 while (*++p == '\t') 190 continue; 191 q = p; 192 while (*p != '\0' && *p != '\t') 193 p++; 194 *p = '\0'; 195 expand(q, exbuf, &exbuf[sizeof exbuf], CurEnv); 196 rwp->r_rhs = prescan(exbuf, '\t', pvpbuf); 197 if (rwp->r_rhs != NULL) 198 rwp->r_rhs = copyplist(rwp->r_rhs, TRUE); 199 break; 200 201 case 'S': /* select rewriting set */ 202 ruleset = atoi(&buf[1]); 203 if (ruleset >= MAXRWSETS || ruleset < 0) 204 { 205 syserr("bad ruleset %d (%d max)", ruleset, MAXRWSETS); 206 ruleset = 0; 207 } 208 rwp = NULL; 209 break; 210 211 case 'D': /* macro definition */ 212 define(buf[1], newstr(munchstring(&buf[2])), CurEnv); 213 break; 214 215 case 'H': /* required header line */ 216 (void) chompheader(&buf[1], TRUE); 217 break; 218 219 case 'C': /* word class */ 220 case 'F': /* word class from file */ 221 /* read list of words from argument or file */ 222 if (buf[0] == 'F') 223 { 224 /* read from file */ 225 for (p = &buf[2]; *p != '\0' && !isspace(*p); p++) 226 continue; 227 if (*p == '\0') 228 p = "%s"; 229 else 230 { 231 *p = '\0'; 232 while (isspace(*++p)) 233 continue; 234 } 235 fileclass(buf[1], &buf[2], p); 236 break; 237 } 238 239 /* scan the list of words and set class for all */ 240 for (p = &buf[2]; *p != '\0'; ) 241 { 242 register char *wd; 243 char delim; 244 245 while (*p != '\0' && isspace(*p)) 246 p++; 247 wd = p; 248 while (*p != '\0' && !isspace(*p)) 249 p++; 250 delim = *p; 251 *p = '\0'; 252 if (wd[0] != '\0') 253 setclass(buf[1], wd); 254 *p = delim; 255 } 256 break; 257 258 case 'M': /* define mailer */ 259 makemailer(&buf[1]); 260 break; 261 262 case 'O': /* set option */ 263 setoption(buf[1], &buf[2], TRUE, FALSE); 264 break; 265 266 case 'P': /* set precedence */ 267 if (NumPriorities >= MAXPRIORITIES) 268 { 269 toomany('P', MAXPRIORITIES); 270 break; 271 } 272 for (p = &buf[1]; *p != '\0' && *p != '=' && *p != '\t'; p++) 273 continue; 274 if (*p == '\0') 275 goto badline; 276 *p = '\0'; 277 Priorities[NumPriorities].pri_name = newstr(&buf[1]); 278 Priorities[NumPriorities].pri_val = atoi(++p); 279 NumPriorities++; 280 break; 281 282 case 'T': /* trusted user(s) */ 283 p = &buf[1]; 284 while (*p != '\0') 285 { 286 while (isspace(*p)) 287 p++; 288 q = p; 289 while (*p != '\0' && !isspace(*p)) 290 p++; 291 if (*p != '\0') 292 *p++ = '\0'; 293 if (*q == '\0') 294 continue; 295 for (pv = TrustedUsers; *pv != NULL; pv++) 296 continue; 297 if (pv >= &TrustedUsers[MAXTRUST]) 298 { 299 toomany('T', MAXTRUST); 300 break; 301 } 302 *pv = newstr(q); 303 } 304 break; 305 306 case 'V': /* configuration syntax version */ 307 ConfigLevel = atoi(&buf[1]); 308 break; 309 310 default: 311 badline: 312 syserr("unknown control line \"%s\"", buf); 313 } 314 } 315 if (ferror(cf)) 316 { 317 syserr("I/O read error", cfname); 318 exit(EX_OSFILE); 319 } 320 fclose(cf); 321 FileName = NULL; 322 } 323 /* 324 ** TOOMANY -- signal too many of some option 325 ** 326 ** Parameters: 327 ** id -- the id of the error line 328 ** maxcnt -- the maximum possible values 329 ** 330 ** Returns: 331 ** none. 332 ** 333 ** Side Effects: 334 ** gives a syserr. 335 */ 336 337 toomany(id, maxcnt) 338 char id; 339 int maxcnt; 340 { 341 syserr("too many %c lines, %d max", id, maxcnt); 342 } 343 /* 344 ** FILECLASS -- read members of a class from a file 345 ** 346 ** Parameters: 347 ** class -- class to define. 348 ** filename -- name of file to read. 349 ** fmt -- scanf string to use for match. 350 ** 351 ** Returns: 352 ** none 353 ** 354 ** Side Effects: 355 ** 356 ** puts all lines in filename that match a scanf into 357 ** the named class. 358 */ 359 360 fileclass(class, filename, fmt) 361 int class; 362 char *filename; 363 char *fmt; 364 { 365 FILE *f; 366 char buf[MAXLINE]; 367 368 if (filename[0] == '|') 369 f = popen(filename + 1, "r"); 370 else 371 f = fopen(filename, "r"); 372 if (f == NULL) 373 { 374 syserr("cannot open %s", filename); 375 return; 376 } 377 378 while (fgets(buf, sizeof buf, f) != NULL) 379 { 380 register STAB *s; 381 register char *p; 382 # ifdef SCANF 383 char wordbuf[MAXNAME+1]; 384 385 if (sscanf(buf, fmt, wordbuf) != 1) 386 continue; 387 p = wordbuf; 388 # else SCANF 389 p = buf; 390 # endif SCANF 391 392 /* 393 ** Break up the match into words. 394 */ 395 396 while (*p != '\0') 397 { 398 register char *q; 399 400 /* strip leading spaces */ 401 while (isspace(*p)) 402 p++; 403 if (*p == '\0') 404 break; 405 406 /* find the end of the word */ 407 q = p; 408 while (*p != '\0' && !isspace(*p)) 409 p++; 410 if (*p != '\0') 411 *p++ = '\0'; 412 413 /* enter the word in the symbol table */ 414 s = stab(q, ST_CLASS, ST_ENTER); 415 setbitn(class, s->s_class); 416 } 417 } 418 419 if (filename[0] == '|') 420 (void) pclose(f); 421 else 422 (void) fclose(f); 423 } 424 /* 425 ** MAKEMAILER -- define a new mailer. 426 ** 427 ** Parameters: 428 ** line -- description of mailer. This is in labeled 429 ** fields. The fields are: 430 ** P -- the path to the mailer 431 ** F -- the flags associated with the mailer 432 ** A -- the argv for this mailer 433 ** S -- the sender rewriting set 434 ** R -- the recipient rewriting set 435 ** E -- the eol string 436 ** The first word is the canonical name of the mailer. 437 ** 438 ** Returns: 439 ** none. 440 ** 441 ** Side Effects: 442 ** enters the mailer into the mailer table. 443 */ 444 445 makemailer(line) 446 char *line; 447 { 448 register char *p; 449 register struct mailer *m; 450 register STAB *s; 451 int i; 452 char fcode; 453 extern int NextMailer; 454 extern char **makeargv(); 455 extern char *munchstring(); 456 extern char *DelimChar; 457 extern long atol(); 458 459 /* allocate a mailer and set up defaults */ 460 m = (struct mailer *) xalloc(sizeof *m); 461 bzero((char *) m, sizeof *m); 462 m->m_mno = NextMailer; 463 m->m_eol = "\n"; 464 465 /* collect the mailer name */ 466 for (p = line; *p != '\0' && *p != ',' && !isspace(*p); p++) 467 continue; 468 if (*p != '\0') 469 *p++ = '\0'; 470 m->m_name = newstr(line); 471 472 /* now scan through and assign info from the fields */ 473 while (*p != '\0') 474 { 475 while (*p != '\0' && (*p == ',' || isspace(*p))) 476 p++; 477 478 /* p now points to field code */ 479 fcode = *p; 480 while (*p != '\0' && *p != '=' && *p != ',') 481 p++; 482 if (*p++ != '=') 483 { 484 syserr("mailer %s: `=' expected", m->m_name); 485 return; 486 } 487 while (isspace(*p)) 488 p++; 489 490 /* p now points to the field body */ 491 p = munchstring(p); 492 493 /* install the field into the mailer struct */ 494 switch (fcode) 495 { 496 case 'P': /* pathname */ 497 m->m_mailer = newstr(p); 498 break; 499 500 case 'F': /* flags */ 501 for (; *p != '\0'; p++) 502 if (!isspace(*p)) 503 setbitn(*p, m->m_flags); 504 break; 505 506 case 'S': /* sender rewriting ruleset */ 507 case 'R': /* recipient rewriting ruleset */ 508 i = atoi(p); 509 if (i < 0 || i >= MAXRWSETS) 510 { 511 syserr("invalid rewrite set, %d max", MAXRWSETS); 512 return; 513 } 514 if (fcode == 'S') 515 m->m_s_rwset = i; 516 else 517 m->m_r_rwset = i; 518 break; 519 520 case 'E': /* end of line string */ 521 m->m_eol = newstr(p); 522 break; 523 524 case 'A': /* argument vector */ 525 m->m_argv = makeargv(p); 526 break; 527 528 case 'M': /* maximum message size */ 529 m->m_maxsize = atol(p); 530 break; 531 532 case 'L': /* maximum line length */ 533 m->m_linelimit = atoi(p); 534 break; 535 } 536 537 p = DelimChar; 538 } 539 540 /* do some heuristic cleanup for back compatibility */ 541 if (bitnset(M_LIMITS, m->m_flags)) 542 { 543 if (m->m_linelimit == 0) 544 m->m_linelimit = SMTPLINELIM; 545 if (!bitnset(M_8BITS, m->m_flags)) 546 setbitn(M_7BITS, m->m_flags); 547 } 548 549 /* now store the mailer away */ 550 if (NextMailer >= MAXMAILERS) 551 { 552 syserr("too many mailers defined (%d max)", MAXMAILERS); 553 return; 554 } 555 Mailer[NextMailer++] = m; 556 s = stab(m->m_name, ST_MAILER, ST_ENTER); 557 s->s_mailer = m; 558 } 559 /* 560 ** MUNCHSTRING -- translate a string into internal form. 561 ** 562 ** Parameters: 563 ** p -- the string to munch. 564 ** 565 ** Returns: 566 ** the munched string. 567 ** 568 ** Side Effects: 569 ** Sets "DelimChar" to point to the string that caused us 570 ** to stop. 571 */ 572 573 char * 574 munchstring(p) 575 register char *p; 576 { 577 register char *q; 578 bool backslash = FALSE; 579 bool quotemode = FALSE; 580 static char buf[MAXLINE]; 581 extern char *DelimChar; 582 583 for (q = buf; *p != '\0'; p++) 584 { 585 if (backslash) 586 { 587 /* everything is roughly literal */ 588 backslash = FALSE; 589 switch (*p) 590 { 591 case 'r': /* carriage return */ 592 *q++ = '\r'; 593 continue; 594 595 case 'n': /* newline */ 596 *q++ = '\n'; 597 continue; 598 599 case 'f': /* form feed */ 600 *q++ = '\f'; 601 continue; 602 603 case 'b': /* backspace */ 604 *q++ = '\b'; 605 continue; 606 } 607 *q++ = *p; 608 } 609 else 610 { 611 if (*p == '\\') 612 backslash = TRUE; 613 else if (*p == '"') 614 quotemode = !quotemode; 615 else if (quotemode || *p != ',') 616 *q++ = *p; 617 else 618 break; 619 } 620 } 621 622 DelimChar = p; 623 *q++ = '\0'; 624 return (buf); 625 } 626 /* 627 ** MAKEARGV -- break up a string into words 628 ** 629 ** Parameters: 630 ** p -- the string to break up. 631 ** 632 ** Returns: 633 ** a char **argv (dynamically allocated) 634 ** 635 ** Side Effects: 636 ** munges p. 637 */ 638 639 char ** 640 makeargv(p) 641 register char *p; 642 { 643 char *q; 644 int i; 645 char **avp; 646 char *argv[MAXPV + 1]; 647 648 /* take apart the words */ 649 i = 0; 650 while (*p != '\0' && i < MAXPV) 651 { 652 q = p; 653 while (*p != '\0' && !isspace(*p)) 654 p++; 655 while (isspace(*p)) 656 *p++ = '\0'; 657 argv[i++] = newstr(q); 658 } 659 argv[i++] = NULL; 660 661 /* now make a copy of the argv */ 662 avp = (char **) xalloc(sizeof *avp * i); 663 bcopy((char *) argv, (char *) avp, sizeof *avp * i); 664 665 return (avp); 666 } 667 /* 668 ** PRINTRULES -- print rewrite rules (for debugging) 669 ** 670 ** Parameters: 671 ** none. 672 ** 673 ** Returns: 674 ** none. 675 ** 676 ** Side Effects: 677 ** prints rewrite rules. 678 */ 679 680 printrules() 681 { 682 register struct rewrite *rwp; 683 register int ruleset; 684 685 for (ruleset = 0; ruleset < 10; ruleset++) 686 { 687 if (RewriteRules[ruleset] == NULL) 688 continue; 689 printf("\n----Rule Set %d:", ruleset); 690 691 for (rwp = RewriteRules[ruleset]; rwp != NULL; rwp = rwp->r_next) 692 { 693 printf("\nLHS:"); 694 printav(rwp->r_lhs); 695 printf("RHS:"); 696 printav(rwp->r_rhs); 697 } 698 } 699 } 700 701 /* 702 ** SETOPTION -- set global processing option 703 ** 704 ** Parameters: 705 ** opt -- option name. 706 ** val -- option value (as a text string). 707 ** safe -- set if this came from a configuration file. 708 ** Some options (if set from the command line) will 709 ** reset the user id to avoid security problems. 710 ** sticky -- if set, don't let other setoptions override 711 ** this value. 712 ** 713 ** Returns: 714 ** none. 715 ** 716 ** Side Effects: 717 ** Sets options as implied by the arguments. 718 */ 719 720 static BITMAP StickyOpt; /* set if option is stuck */ 721 722 setoption(opt, val, safe, sticky) 723 char opt; 724 char *val; 725 bool safe; 726 bool sticky; 727 { 728 extern bool atobool(); 729 extern time_t convtime(); 730 extern int QueueLA; 731 extern int RefuseLA; 732 extern bool trusteduser(); 733 extern char *username(); 734 735 if (tTd(37, 1)) 736 printf("setoption %c=%s", opt, val); 737 738 /* 739 ** See if this option is preset for us. 740 */ 741 742 if (bitnset(opt, StickyOpt)) 743 { 744 if (tTd(37, 1)) 745 printf(" (ignored)\n"); 746 return; 747 } 748 749 /* 750 ** Check to see if this option can be specified by this user. 751 */ 752 753 if (!safe && getuid() == 0) 754 safe = TRUE; 755 if (!safe && index("deiLmorsv", opt) == NULL) 756 { 757 if (opt != 'M' || (val[0] != 'r' && val[0] != 's')) 758 { 759 if (tTd(37, 1)) 760 printf(" (unsafe)"); 761 if (getuid() != geteuid()) 762 { 763 if (tTd(37, 1)) 764 printf("(Resetting uid)"); 765 (void) setgid(getgid()); 766 (void) setuid(getuid()); 767 } 768 } 769 } 770 if (tTd(37, 1)) 771 printf("\n"); 772 773 switch (opt) 774 { 775 case '=': /* config file generation level */ 776 ConfigLevel = atoi(val); 777 break; 778 779 case '8': /* allow eight-bit input */ 780 EightBit = atobool(val); 781 break; 782 783 case 'A': /* set default alias file */ 784 if (val[0] == '\0') 785 AliasFile = "aliases"; 786 else 787 AliasFile = newstr(val); 788 break; 789 790 case 'a': /* look N minutes for "@:@" in alias file */ 791 if (val[0] == '\0') 792 SafeAlias = 5; 793 else 794 SafeAlias = atoi(val); 795 break; 796 797 case 'B': /* substitution for blank character */ 798 SpaceSub = val[0]; 799 if (SpaceSub == '\0') 800 SpaceSub = ' '; 801 break; 802 803 case 'c': /* don't connect to "expensive" mailers */ 804 NoConnect = atobool(val); 805 break; 806 807 case 'C': /* checkpoint every N addresses */ 808 CheckpointInterval = atoi(val); 809 break; 810 811 case 'd': /* delivery mode */ 812 switch (*val) 813 { 814 case '\0': 815 SendMode = SM_DELIVER; 816 break; 817 818 case SM_QUEUE: /* queue only */ 819 #ifndef QUEUE 820 syserr("need QUEUE to set -odqueue"); 821 #endif QUEUE 822 /* fall through..... */ 823 824 case SM_DELIVER: /* do everything */ 825 case SM_FORK: /* fork after verification */ 826 SendMode = *val; 827 break; 828 829 default: 830 syserr("Unknown delivery mode %c", *val); 831 exit(EX_USAGE); 832 } 833 break; 834 835 case 'D': /* rebuild alias database as needed */ 836 AutoRebuild = atobool(val); 837 break; 838 839 case 'e': /* set error processing mode */ 840 switch (*val) 841 { 842 case EM_QUIET: /* be silent about it */ 843 case EM_MAIL: /* mail back */ 844 case EM_BERKNET: /* do berknet error processing */ 845 case EM_WRITE: /* write back (or mail) */ 846 HoldErrs = TRUE; 847 /* fall through... */ 848 849 case EM_PRINT: /* print errors normally (default) */ 850 ErrorMode = *val; 851 break; 852 } 853 break; 854 855 case 'F': /* file mode */ 856 FileMode = atooct(val) & 0777; 857 break; 858 859 case 'f': /* save Unix-style From lines on front */ 860 SaveFrom = atobool(val); 861 break; 862 863 case 'g': /* default gid */ 864 DefGid = atoi(val); 865 break; 866 867 case 'H': /* help file */ 868 if (val[0] == '\0') 869 HelpFile = "sendmail.hf"; 870 else 871 HelpFile = newstr(val); 872 break; 873 874 case 'h': /* maximum hop count */ 875 MaxHopCount = atoi(val); 876 break; 877 878 case 'I': /* use internet domain name server */ 879 UseNameServer = atobool(val); 880 break; 881 882 case 'i': /* ignore dot lines in message */ 883 IgnrDot = atobool(val); 884 break; 885 886 case 'L': /* log level */ 887 LogLevel = atoi(val); 888 break; 889 890 case 'M': /* define macro */ 891 define(val[0], newstr(&val[1]), CurEnv); 892 sticky = FALSE; 893 break; 894 895 case 'm': /* send to me too */ 896 MeToo = atobool(val); 897 break; 898 899 case 'n': /* validate RHS in newaliases */ 900 CheckAliases = atobool(val); 901 break; 902 903 case 'o': /* assume old style headers */ 904 if (atobool(val)) 905 CurEnv->e_flags |= EF_OLDSTYLE; 906 else 907 CurEnv->e_flags &= ~EF_OLDSTYLE; 908 break; 909 910 case 'P': /* postmaster copy address for returned mail */ 911 PostMasterCopy = newstr(val); 912 break; 913 914 case 'q': /* slope of queue only function */ 915 QueueFactor = atoi(val); 916 break; 917 918 case 'Q': /* queue directory */ 919 if (val[0] == '\0') 920 QueueDir = "mqueue"; 921 else 922 QueueDir = newstr(val); 923 break; 924 925 case 'r': /* read timeout */ 926 ReadTimeout = convtime(val); 927 break; 928 929 case 'S': /* status file */ 930 if (val[0] == '\0') 931 StatFile = "sendmail.st"; 932 else 933 StatFile = newstr(val); 934 break; 935 936 case 's': /* be super safe, even if expensive */ 937 SuperSafe = atobool(val); 938 break; 939 940 case 'T': /* queue timeout */ 941 TimeOut = convtime(val); 942 /*FALLTHROUGH*/ 943 944 case 't': /* time zone name */ 945 TimeZoneSpec = newstr(val); 946 break; 947 948 case 'U': /* location of user database */ 949 UdbSpec = newstr(val); 950 break; 951 952 case 'u': /* set default uid */ 953 DefUid = atoi(val); 954 setdefuser(); 955 break; 956 957 case 'v': /* run in verbose mode */ 958 Verbose = atobool(val); 959 break; 960 961 case 'w': /* we don't have wildcard MX records */ 962 NoWildcardMX = atobool(val); 963 break; 964 965 case 'x': /* load avg at which to auto-queue msgs */ 966 QueueLA = atoi(val); 967 break; 968 969 case 'X': /* load avg at which to auto-reject connections */ 970 RefuseLA = atoi(val); 971 break; 972 973 case 'y': /* work recipient factor */ 974 WkRecipFact = atoi(val); 975 break; 976 977 case 'Y': /* fork jobs during queue runs */ 978 ForkQueueRuns = atobool(val); 979 break; 980 981 case 'z': /* work message class factor */ 982 WkClassFact = atoi(val); 983 break; 984 985 case 'Z': /* work time factor */ 986 WkTimeFact = atoi(val); 987 break; 988 989 default: 990 break; 991 } 992 if (sticky) 993 setbitn(opt, StickyOpt); 994 return; 995 } 996 /* 997 ** SETCLASS -- set a word into a class 998 ** 999 ** Parameters: 1000 ** class -- the class to put the word in. 1001 ** word -- the word to enter 1002 ** 1003 ** Returns: 1004 ** none. 1005 ** 1006 ** Side Effects: 1007 ** puts the word into the symbol table. 1008 */ 1009 1010 setclass(class, word) 1011 int class; 1012 char *word; 1013 { 1014 register STAB *s; 1015 1016 s = stab(word, ST_CLASS, ST_ENTER); 1017 setbitn(class, s->s_class); 1018 } 1019