13313Seric # include "sendmail.h" 23308Seric 3*14879Seric SCCSID(@(#)readcf.c 4.2 08/28/83); 43308Seric 53308Seric /* 63308Seric ** READCF -- read control file. 73308Seric ** 83308Seric ** This routine reads the control file and builds the internal 93308Seric ** form. 103308Seric ** 114432Seric ** The file is formatted as a sequence of lines, each taken 124432Seric ** atomically. The first character of each line describes how 134432Seric ** the line is to be interpreted. The lines are: 144432Seric ** Dxval Define macro x to have value val. 154432Seric ** Cxword Put word into class x. 164432Seric ** Fxfile [fmt] Read file for lines to put into 174432Seric ** class x. Use scanf string 'fmt' 184432Seric ** or "%s" if not present. Fmt should 194432Seric ** only produce one string-valued result. 204432Seric ** Hname: value Define header with field-name 'name' 214432Seric ** and value as specified; this will be 224432Seric ** macro expanded immediately before 234432Seric ** use. 244432Seric ** Sn Use rewriting set n. 254432Seric ** Rlhs rhs Rewrite addresses that match lhs to 264432Seric ** be rhs. 278252Seric ** Mn p f s r a Define mailer. n - internal name, 288252Seric ** p - pathname, f - flags, s - rewriting 298252Seric ** ruleset for sender, s - rewriting ruleset 308252Seric ** for recipients, a - argument vector. 318252Seric ** Oxvalue Set option x to value. 328252Seric ** Pname=value Set precedence name to value. 334432Seric ** 343308Seric ** Parameters: 353308Seric ** cfname -- control file name. 364217Seric ** safe -- set if this is a system configuration file. 374217Seric ** Non-system configuration files can not do 384217Seric ** certain things (e.g., leave the SUID bit on 394217Seric ** when executing mailers). 403308Seric ** 413308Seric ** Returns: 423308Seric ** none. 433308Seric ** 443308Seric ** Side Effects: 453308Seric ** Builds several internal tables. 463308Seric */ 473308Seric 484217Seric readcf(cfname, safe) 493308Seric char *cfname; 504217Seric bool safe; 513308Seric { 523308Seric FILE *cf; 538547Seric int ruleset = 0; 548547Seric char *q; 558547Seric char **pv; 569350Seric struct rewrite *rwp = NULL; 573308Seric char buf[MAXLINE]; 583308Seric register char *p; 593308Seric extern char **prescan(); 603308Seric extern char **copyplist(); 615909Seric char exbuf[MAXLINE]; 629350Seric extern char *fgetfolded(); 6310709Seric extern char *munchstring(); 643308Seric 653308Seric cf = fopen(cfname, "r"); 663308Seric if (cf == NULL) 673308Seric { 683308Seric syserr("cannot open %s", cfname); 693308Seric exit(EX_OSFILE); 703308Seric } 713308Seric 729381Seric FileName = cfname; 738056Seric LineNumber = 0; 747854Seric while (fgetfolded(buf, sizeof buf, cf) != NULL) 753308Seric { 763308Seric switch (buf[0]) 773308Seric { 783308Seric case '\0': 793308Seric case '#': /* comment */ 803308Seric break; 813308Seric 823308Seric case 'R': /* rewriting rule */ 833308Seric for (p = &buf[1]; *p != '\0' && *p != '\t'; p++) 843308Seric continue; 853308Seric 863308Seric if (*p == '\0') 875909Seric { 889381Seric syserr("invalid rewrite line \"%s\"", buf); 895909Seric break; 905909Seric } 915909Seric 925909Seric /* allocate space for the rule header */ 935909Seric if (rwp == NULL) 945909Seric { 955909Seric RewriteRules[ruleset] = rwp = 965909Seric (struct rewrite *) xalloc(sizeof *rwp); 975909Seric } 983308Seric else 993308Seric { 1005909Seric rwp->r_next = (struct rewrite *) xalloc(sizeof *rwp); 1015909Seric rwp = rwp->r_next; 1025909Seric } 1035909Seric rwp->r_next = NULL; 1043308Seric 1055909Seric /* expand and save the LHS */ 1065909Seric *p = '\0'; 1076991Seric expand(&buf[1], exbuf, &exbuf[sizeof exbuf], CurEnv); 1085909Seric rwp->r_lhs = prescan(exbuf, '\t'); 1095909Seric if (rwp->r_lhs != NULL) 1105909Seric rwp->r_lhs = copyplist(rwp->r_lhs, TRUE); 1115909Seric 1125909Seric /* expand and save the RHS */ 1135909Seric while (*++p == '\t') 1145909Seric continue; 1157231Seric q = p; 1167231Seric while (*p != '\0' && *p != '\t') 1177231Seric p++; 1187231Seric *p = '\0'; 1197231Seric expand(q, exbuf, &exbuf[sizeof exbuf], CurEnv); 1205909Seric rwp->r_rhs = prescan(exbuf, '\t'); 1215909Seric if (rwp->r_rhs != NULL) 1225909Seric rwp->r_rhs = copyplist(rwp->r_rhs, TRUE); 1233308Seric break; 1243308Seric 1254072Seric case 'S': /* select rewriting set */ 1264072Seric ruleset = atoi(&buf[1]); 1278056Seric if (ruleset >= MAXRWSETS || ruleset < 0) 1288056Seric { 1299381Seric syserr("bad ruleset %d (%d max)", ruleset, MAXRWSETS); 1308056Seric ruleset = 0; 1318056Seric } 1324072Seric rwp = NULL; 1334072Seric break; 1344072Seric 1353308Seric case 'D': /* macro definition */ 13610709Seric define(buf[1], newstr(munchstring(&buf[2])), CurEnv); 1373308Seric break; 1383308Seric 1393387Seric case 'H': /* required header line */ 1404088Seric (void) chompheader(&buf[1], TRUE); 1413387Seric break; 1423387Seric 1434061Seric case 'C': /* word class */ 1444432Seric case 'F': /* word class from file */ 1454432Seric /* read list of words from argument or file */ 1464432Seric if (buf[0] == 'F') 1474432Seric { 1484432Seric /* read from file */ 1494432Seric for (p = &buf[2]; *p != '\0' && !isspace(*p); p++) 1504432Seric continue; 1514432Seric if (*p == '\0') 1524432Seric p = "%s"; 1534432Seric else 1544432Seric { 1554432Seric *p = '\0'; 1564432Seric while (isspace(*++p)) 1574432Seric continue; 1584432Seric } 15910687Seric fileclass(buf[1], &buf[2], p); 1604432Seric break; 1614432Seric } 1624061Seric 1634432Seric /* scan the list of words and set class for all */ 1644061Seric for (p = &buf[2]; *p != '\0'; ) 1654061Seric { 1664061Seric register char *wd; 1674061Seric char delim; 1684061Seric 1694061Seric while (*p != '\0' && isspace(*p)) 1704061Seric p++; 1714061Seric wd = p; 1724061Seric while (*p != '\0' && !isspace(*p)) 1734061Seric p++; 1744061Seric delim = *p; 1754061Seric *p = '\0'; 1764061Seric if (wd[0] != '\0') 17710687Seric setclass(buf[1], wd); 1784061Seric *p = delim; 1794061Seric } 1804061Seric break; 1814061Seric 1824096Seric case 'M': /* define mailer */ 1834217Seric makemailer(&buf[1], safe); 1844096Seric break; 1854096Seric 1868252Seric case 'O': /* set option */ 1878269Seric setoption(buf[1], &buf[2], safe, FALSE); 1888252Seric break; 1898252Seric 1908252Seric case 'P': /* set precedence */ 1918252Seric if (NumPriorities >= MAXPRIORITIES) 1928252Seric { 1938547Seric toomany('P', MAXPRIORITIES); 1948252Seric break; 1958252Seric } 1969381Seric for (p = &buf[1]; *p != '\0' && *p != '=' && *p != '\t'; p++) 1978252Seric continue; 1988252Seric if (*p == '\0') 1998252Seric goto badline; 2008252Seric *p = '\0'; 2018252Seric Priorities[NumPriorities].pri_name = newstr(&buf[1]); 2028252Seric Priorities[NumPriorities].pri_val = atoi(++p); 2038252Seric NumPriorities++; 2048252Seric break; 2058252Seric 2068547Seric case 'T': /* trusted user(s) */ 2078547Seric p = &buf[1]; 2088547Seric while (*p != '\0') 2098547Seric { 2108547Seric while (isspace(*p)) 2118547Seric p++; 2128547Seric q = p; 2138547Seric while (*p != '\0' && !isspace(*p)) 2148547Seric p++; 2158547Seric if (*p != '\0') 2168547Seric *p++ = '\0'; 2178547Seric if (*q == '\0') 2188547Seric continue; 2198547Seric for (pv = TrustedUsers; *pv != NULL; pv++) 2208547Seric continue; 2218547Seric if (pv >= &TrustedUsers[MAXTRUST]) 2228547Seric { 2238547Seric toomany('T', MAXTRUST); 2248547Seric break; 2258547Seric } 2268547Seric *pv = newstr(q); 2278547Seric } 2288547Seric break; 2298547Seric 2303308Seric default: 2314061Seric badline: 2329381Seric syserr("unknown control line \"%s\"", buf); 2333308Seric } 2343308Seric } 2359381Seric FileName = NULL; 2364096Seric } 2374096Seric /* 2388547Seric ** TOOMANY -- signal too many of some option 2398547Seric ** 2408547Seric ** Parameters: 2418547Seric ** id -- the id of the error line 2428547Seric ** maxcnt -- the maximum possible values 2438547Seric ** 2448547Seric ** Returns: 2458547Seric ** none. 2468547Seric ** 2478547Seric ** Side Effects: 2488547Seric ** gives a syserr. 2498547Seric */ 2508547Seric 2518547Seric toomany(id, maxcnt) 2528547Seric char id; 2538547Seric int maxcnt; 2548547Seric { 2559381Seric syserr("too many %c lines, %d max", id, maxcnt); 2568547Seric } 2578547Seric /* 2584432Seric ** FILECLASS -- read members of a class from a file 2594432Seric ** 2604432Seric ** Parameters: 2614432Seric ** class -- class to define. 2624432Seric ** filename -- name of file to read. 2634432Seric ** fmt -- scanf string to use for match. 2644432Seric ** 2654432Seric ** Returns: 2664432Seric ** none 2674432Seric ** 2684432Seric ** Side Effects: 2694432Seric ** 2704432Seric ** puts all lines in filename that match a scanf into 2714432Seric ** the named class. 2724432Seric */ 2734432Seric 2744432Seric fileclass(class, filename, fmt) 2754432Seric int class; 2764432Seric char *filename; 2774432Seric char *fmt; 2784432Seric { 2794432Seric register FILE *f; 2804432Seric char buf[MAXLINE]; 2814432Seric 2824432Seric f = fopen(filename, "r"); 2834432Seric if (f == NULL) 2844432Seric { 2854432Seric syserr("cannot open %s", filename); 2864432Seric return; 2874432Seric } 2884432Seric 2894432Seric while (fgets(buf, sizeof buf, f) != NULL) 2904432Seric { 2914432Seric register STAB *s; 2924432Seric char wordbuf[MAXNAME+1]; 2934432Seric 2944432Seric if (sscanf(buf, fmt, wordbuf) != 1) 2954432Seric continue; 2964432Seric s = stab(wordbuf, ST_CLASS, ST_ENTER); 29710687Seric setbitn(class, s->s_class); 2984432Seric } 2994432Seric 3004627Seric (void) fclose(f); 3014432Seric } 3024432Seric /* 3034096Seric ** MAKEMAILER -- define a new mailer. 3044096Seric ** 3054096Seric ** Parameters: 30610327Seric ** line -- description of mailer. This is in labeled 30710327Seric ** fields. The fields are: 30810327Seric ** P -- the path to the mailer 30910327Seric ** F -- the flags associated with the mailer 31010327Seric ** A -- the argv for this mailer 31110327Seric ** S -- the sender rewriting set 31210327Seric ** R -- the recipient rewriting set 31310327Seric ** E -- the eol string 31410327Seric ** The first word is the canonical name of the mailer. 3154217Seric ** safe -- set if this is a safe configuration file. 3164096Seric ** 3174096Seric ** Returns: 3184096Seric ** none. 3194096Seric ** 3204096Seric ** Side Effects: 3214096Seric ** enters the mailer into the mailer table. 3224096Seric */ 3233308Seric 3244217Seric makemailer(line, safe) 3254096Seric char *line; 3264217Seric bool safe; 3274096Seric { 3284096Seric register char *p; 3298067Seric register struct mailer *m; 3308067Seric register STAB *s; 3318067Seric int i; 33210327Seric char fcode; 3334096Seric extern int NextMailer; 33410327Seric extern char **makeargv(); 33510327Seric extern char *munchstring(); 33610327Seric extern char *DelimChar; 33710701Seric extern long atol(); 3384096Seric 33910327Seric /* allocate a mailer and set up defaults */ 34010327Seric m = (struct mailer *) xalloc(sizeof *m); 34110327Seric bzero((char *) m, sizeof *m); 34210327Seric m->m_mno = NextMailer; 34310327Seric m->m_eol = "\n"; 34410327Seric 34510327Seric /* collect the mailer name */ 34610327Seric for (p = line; *p != '\0' && *p != ',' && !isspace(*p); p++) 34710327Seric continue; 34810327Seric if (*p != '\0') 34910327Seric *p++ = '\0'; 35010327Seric m->m_name = newstr(line); 35110327Seric 35210327Seric /* now scan through and assign info from the fields */ 35310327Seric while (*p != '\0') 35410327Seric { 35510327Seric while (*p != '\0' && (*p == ',' || isspace(*p))) 35610327Seric p++; 35710327Seric 35810327Seric /* p now points to field code */ 35910327Seric fcode = *p; 36010327Seric while (*p != '\0' && *p != '=' && *p != ',') 36110327Seric p++; 36210327Seric if (*p++ != '=') 36310327Seric { 36410327Seric syserr("`=' expected"); 36510327Seric return; 36610327Seric } 36710327Seric while (isspace(*p)) 36810327Seric p++; 36910327Seric 37010327Seric /* p now points to the field body */ 37110327Seric p = munchstring(p); 37210327Seric 37310327Seric /* install the field into the mailer struct */ 37410327Seric switch (fcode) 37510327Seric { 37610327Seric case 'P': /* pathname */ 37710327Seric m->m_mailer = newstr(p); 37810327Seric break; 37910327Seric 38010327Seric case 'F': /* flags */ 38110687Seric for (; *p != '\0'; p++) 38210687Seric setbitn(*p, m->m_flags); 38310327Seric if (!safe) 38410687Seric clrbitn(M_RESTR, m->m_flags); 38510327Seric break; 38610327Seric 38710327Seric case 'S': /* sender rewriting ruleset */ 38810327Seric case 'R': /* recipient rewriting ruleset */ 38910327Seric i = atoi(p); 39010327Seric if (i < 0 || i >= MAXRWSETS) 39110327Seric { 39210327Seric syserr("invalid rewrite set, %d max", MAXRWSETS); 39310327Seric return; 39410327Seric } 39510327Seric if (fcode == 'S') 39610327Seric m->m_s_rwset = i; 39710327Seric else 39810327Seric m->m_r_rwset = i; 39910327Seric break; 40010327Seric 40110327Seric case 'E': /* end of line string */ 40210327Seric m->m_eol = newstr(p); 40310327Seric break; 40410327Seric 40510327Seric case 'A': /* argument vector */ 40610327Seric m->m_argv = makeargv(p); 40710327Seric break; 40810701Seric 40910701Seric case 'M': /* maximum message size */ 41010701Seric m->m_maxsize = atol(p); 41110701Seric break; 41210327Seric } 41310327Seric 41410327Seric p = DelimChar; 41510327Seric } 41610327Seric 41710327Seric /* now store the mailer away */ 4184096Seric if (NextMailer >= MAXMAILERS) 4194096Seric { 4209381Seric syserr("too many mailers defined (%d max)", MAXMAILERS); 4214096Seric return; 4224096Seric } 42310327Seric Mailer[NextMailer++] = m; 42410327Seric s = stab(m->m_name, ST_MAILER, ST_ENTER); 42510327Seric s->s_mailer = m; 42610327Seric } 42710327Seric /* 42810327Seric ** MUNCHSTRING -- translate a string into internal form. 42910327Seric ** 43010327Seric ** Parameters: 43110327Seric ** p -- the string to munch. 43210327Seric ** 43310327Seric ** Returns: 43410327Seric ** the munched string. 43510327Seric ** 43610327Seric ** Side Effects: 43710327Seric ** Sets "DelimChar" to point to the string that caused us 43810327Seric ** to stop. 43910327Seric */ 4404096Seric 44110327Seric char * 44210327Seric munchstring(p) 44310327Seric register char *p; 44410327Seric { 44510327Seric register char *q; 44610327Seric bool backslash = FALSE; 44710327Seric bool quotemode = FALSE; 44810327Seric static char buf[MAXLINE]; 44910327Seric extern char *DelimChar; 4504096Seric 45110327Seric for (q = buf; *p != '\0'; p++) 4524096Seric { 45310327Seric if (backslash) 45410327Seric { 45510327Seric /* everything is roughly literal */ 45610357Seric backslash = FALSE; 45710327Seric switch (*p) 45810327Seric { 45910327Seric case 'r': /* carriage return */ 46010327Seric *q++ = '\r'; 46110327Seric continue; 46210327Seric 46310327Seric case 'n': /* newline */ 46410327Seric *q++ = '\n'; 46510327Seric continue; 46610327Seric 46710327Seric case 'f': /* form feed */ 46810327Seric *q++ = '\f'; 46910327Seric continue; 47010327Seric 47110327Seric case 'b': /* backspace */ 47210327Seric *q++ = '\b'; 47310327Seric continue; 47410327Seric } 47510327Seric *q++ = *p; 47610327Seric } 47710327Seric else 47810327Seric { 47910327Seric if (*p == '\\') 48010327Seric backslash = TRUE; 48110327Seric else if (*p == '"') 48210327Seric quotemode = !quotemode; 48310327Seric else if (quotemode || *p != ',') 48410327Seric *q++ = *p; 48510327Seric else 48610327Seric break; 48710327Seric } 4884096Seric } 4894096Seric 49010327Seric DelimChar = p; 49110327Seric *q++ = '\0'; 49210327Seric return (buf); 49310327Seric } 49410327Seric /* 49510327Seric ** MAKEARGV -- break up a string into words 49610327Seric ** 49710327Seric ** Parameters: 49810327Seric ** p -- the string to break up. 49910327Seric ** 50010327Seric ** Returns: 50110327Seric ** a char **argv (dynamically allocated) 50210327Seric ** 50310327Seric ** Side Effects: 50410327Seric ** munges p. 50510327Seric */ 5064096Seric 50710327Seric char ** 50810327Seric makeargv(p) 50910327Seric register char *p; 51010327Seric { 51110327Seric char *q; 51210327Seric int i; 51310327Seric char **avp; 51410327Seric char *argv[MAXPV + 1]; 51510327Seric 51610327Seric /* take apart the words */ 51710327Seric i = 0; 51810327Seric while (*p != '\0' && i < MAXPV) 5194096Seric { 52010327Seric q = p; 52110327Seric while (*p != '\0' && !isspace(*p)) 52210327Seric p++; 52310327Seric while (isspace(*p)) 52410327Seric *p++ = '\0'; 52510327Seric argv[i++] = newstr(q); 5264096Seric } 52710327Seric argv[i++] = NULL; 5284096Seric 52910327Seric /* now make a copy of the argv */ 53010327Seric avp = (char **) xalloc(sizeof *avp * i); 53110327Seric bmove((char *) argv, (char *) avp, sizeof *avp * i); 53210327Seric 53310327Seric return (avp); 5343308Seric } 5353308Seric /* 5363308Seric ** PRINTRULES -- print rewrite rules (for debugging) 5373308Seric ** 5383308Seric ** Parameters: 5393308Seric ** none. 5403308Seric ** 5413308Seric ** Returns: 5423308Seric ** none. 5433308Seric ** 5443308Seric ** Side Effects: 5453308Seric ** prints rewrite rules. 5463308Seric */ 5473308Seric 5484319Seric # ifdef DEBUG 5494319Seric 5503308Seric printrules() 5513308Seric { 5523308Seric register struct rewrite *rwp; 5534072Seric register int ruleset; 5543308Seric 5554072Seric for (ruleset = 0; ruleset < 10; ruleset++) 5563308Seric { 5574072Seric if (RewriteRules[ruleset] == NULL) 5584072Seric continue; 5598067Seric printf("\n----Rule Set %d:", ruleset); 5603308Seric 5614072Seric for (rwp = RewriteRules[ruleset]; rwp != NULL; rwp = rwp->r_next) 5623308Seric { 5638067Seric printf("\nLHS:"); 5648067Seric printav(rwp->r_lhs); 5658067Seric printf("RHS:"); 5668067Seric printav(rwp->r_rhs); 5673308Seric } 5683308Seric } 5693308Seric } 5704319Seric 5714319Seric # endif DEBUG 5724096Seric /* 5738256Seric ** SETOPTION -- set global processing option 5748256Seric ** 5758256Seric ** Parameters: 5768256Seric ** opt -- option name. 5778256Seric ** val -- option value (as a text string). 5788269Seric ** safe -- if set, this came from a system configuration file. 5798269Seric ** sticky -- if set, don't let other setoptions override 5808269Seric ** this value. 5818256Seric ** 5828256Seric ** Returns: 5838256Seric ** none. 5848256Seric ** 5858256Seric ** Side Effects: 5868256Seric ** Sets options as implied by the arguments. 5878256Seric */ 5888256Seric 58910687Seric static BITMAP StickyOpt; /* set if option is stuck */ 59010687Seric extern char *WizWord; /* the stored wizard password */ 5918269Seric 5928269Seric setoption(opt, val, safe, sticky) 5938256Seric char opt; 5948256Seric char *val; 5958269Seric bool safe; 5968269Seric bool sticky; 5978256Seric { 5988265Seric extern bool atobool(); 59912633Seric extern time_t convtime(); 600*14879Seric extern int QueueLA; 601*14879Seric extern int RefuseLA; 6028256Seric 6038256Seric # ifdef DEBUG 6048256Seric if (tTd(37, 1)) 6059341Seric printf("setoption %c=%s", opt, val); 6068256Seric # endif DEBUG 6078256Seric 6088256Seric /* 6098269Seric ** See if this option is preset for us. 6108256Seric */ 6118256Seric 61210687Seric if (bitnset(opt, StickyOpt)) 6138269Seric { 6148269Seric # ifdef DEBUG 6159341Seric if (tTd(37, 1)) 6169341Seric printf(" (ignored)\n"); 6178269Seric # endif DEBUG 6188269Seric return; 6198269Seric } 6209341Seric #ifdef DEBUG 6219341Seric else if (tTd(37, 1)) 6229341Seric printf("\n"); 6239341Seric #endif DEBUG 6248269Seric if (sticky) 62510687Seric setbitn(opt, StickyOpt); 6268269Seric 6278269Seric if (getruid() == 0) 6288269Seric safe = TRUE; 6298269Seric 6308256Seric switch (opt) 6318256Seric { 6328256Seric case 'A': /* set default alias file */ 6339381Seric if (val[0] == '\0') 6348269Seric AliasFile = "aliases"; 6359381Seric else 6369381Seric AliasFile = newstr(val); 6378256Seric break; 6388256Seric 6398931Seric case 'a': /* look for "@:@" in alias file */ 6409381Seric SafeAlias = atobool(val); 6418931Seric break; 6428931Seric 6439284Seric case 'c': /* don't connect to "expensive" mailers */ 6449381Seric NoConnect = atobool(val); 6459284Seric break; 6469284Seric 6479284Seric case 'd': /* delivery mode */ 6489284Seric switch (*val) 6498269Seric { 6509284Seric case '\0': 6519284Seric SendMode = SM_DELIVER; 6528269Seric break; 6538269Seric 65410755Seric case SM_QUEUE: /* queue only */ 65510755Seric #ifndef QUEUE 65610755Seric syserr("need QUEUE to set -odqueue"); 65710755Seric #endif QUEUE 65810755Seric /* fall through..... */ 65910755Seric 6609284Seric case SM_DELIVER: /* do everything */ 6619284Seric case SM_FORK: /* fork after verification */ 6629284Seric SendMode = *val; 6638269Seric break; 6648269Seric 6658269Seric default: 6669284Seric syserr("Unknown delivery mode %c", *val); 6678269Seric exit(EX_USAGE); 6688269Seric } 6698269Seric break; 6708269Seric 6719146Seric case 'D': /* rebuild alias database as needed */ 6729381Seric AutoRebuild = atobool(val); 6739146Seric break; 6749146Seric 6758269Seric case 'e': /* set error processing mode */ 6768269Seric switch (*val) 6778269Seric { 6789381Seric case EM_QUIET: /* be silent about it */ 6799381Seric case EM_MAIL: /* mail back */ 6809381Seric case EM_BERKNET: /* do berknet error processing */ 6819381Seric case EM_WRITE: /* write back (or mail) */ 6828269Seric HoldErrs = TRUE; 6839381Seric /* fall through... */ 6848269Seric 6859381Seric case EM_PRINT: /* print errors normally (default) */ 6869381Seric ErrorMode = *val; 6878269Seric break; 6888269Seric } 6898269Seric break; 6908269Seric 6919049Seric case 'F': /* file mode */ 6929381Seric FileMode = atooct(val); 6939049Seric break; 6949049Seric 6958269Seric case 'f': /* save Unix-style From lines on front */ 6969381Seric SaveFrom = atobool(val); 6978269Seric break; 6988269Seric 6998256Seric case 'g': /* default gid */ 7009105Seric if (safe) 7019381Seric DefGid = atoi(val); 7028256Seric break; 7038256Seric 7048256Seric case 'H': /* help file */ 7059381Seric if (val[0] == '\0') 7068269Seric HelpFile = "sendmail.hf"; 7079381Seric else 7089381Seric HelpFile = newstr(val); 7098256Seric break; 7108256Seric 7118269Seric case 'i': /* ignore dot lines in message */ 7129381Seric IgnrDot = atobool(val); 7138269Seric break; 7148269Seric 7158256Seric case 'L': /* log level */ 7169381Seric LogLevel = atoi(val); 7178256Seric break; 7188256Seric 7198269Seric case 'M': /* define macro */ 7209381Seric define(val[0], newstr(&val[1]), CurEnv); 7218269Seric break; 7228269Seric 7238269Seric case 'm': /* send to me too */ 7249381Seric MeToo = atobool(val); 7258269Seric break; 7268269Seric 7278269Seric case 'o': /* assume old style headers */ 7289381Seric if (atobool(val)) 7299341Seric CurEnv->e_flags |= EF_OLDSTYLE; 7309341Seric else 7319341Seric CurEnv->e_flags &= ~EF_OLDSTYLE; 7328269Seric break; 7338269Seric 7348256Seric case 'Q': /* queue directory */ 7359381Seric if (val[0] == '\0') 7368269Seric QueueDir = "mqueue"; 7379381Seric else 7389381Seric QueueDir = newstr(val); 7398256Seric break; 7408256Seric 7418256Seric case 'r': /* read timeout */ 7429381Seric ReadTimeout = convtime(val); 7438256Seric break; 7448256Seric 7458256Seric case 'S': /* status file */ 7469381Seric if (val[0] == '\0') 7478269Seric StatFile = "sendmail.st"; 7489381Seric else 7499381Seric StatFile = newstr(val); 7508256Seric break; 7518256Seric 7528265Seric case 's': /* be super safe, even if expensive */ 7539381Seric SuperSafe = atobool(val); 7548256Seric break; 7558256Seric 7568256Seric case 'T': /* queue timeout */ 7579381Seric TimeOut = convtime(val); 7588256Seric break; 7598256Seric 7608265Seric case 't': /* time zone name */ 7618265Seric # ifdef V6 7629381Seric StdTimezone = newstr(val); 7639381Seric DstTimezone = index(StdTimeZone, ','); 7648265Seric if (DstTimezone == NULL) 7659381Seric syserr("bad time zone spec"); 7669381Seric else 7679381Seric *DstTimezone++ = '\0'; 7688265Seric # endif V6 7698265Seric break; 7708265Seric 7718256Seric case 'u': /* set default uid */ 7729105Seric if (safe) 7739381Seric DefUid = atoi(val); 7748256Seric break; 7758256Seric 7768269Seric case 'v': /* run in verbose mode */ 7779381Seric Verbose = atobool(val); 7788256Seric break; 7798256Seric 7808544Seric # ifdef DEBUG 7818544Seric case 'W': /* set the wizards password */ 7829105Seric if (safe) 7839381Seric WizWord = newstr(val); 7848544Seric break; 7858544Seric # endif DEBUG 7868544Seric 787*14879Seric case 'x': /* load avg at which to auto-queue msgs */ 788*14879Seric QueueLA = atoi(val); 789*14879Seric break; 790*14879Seric 791*14879Seric case 'X': /* load avg at which to auto-reject connections */ 792*14879Seric RefuseLA = atoi(val); 793*14879Seric break; 794*14879Seric 7958256Seric default: 7968256Seric break; 7978256Seric } 7989188Seric return; 7998256Seric } 80010687Seric /* 80110687Seric ** SETCLASS -- set a word into a class 80210687Seric ** 80310687Seric ** Parameters: 80410687Seric ** class -- the class to put the word in. 80510687Seric ** word -- the word to enter 80610687Seric ** 80710687Seric ** Returns: 80810687Seric ** none. 80910687Seric ** 81010687Seric ** Side Effects: 81110687Seric ** puts the word into the symbol table. 81210687Seric */ 81310687Seric 81410687Seric setclass(class, word) 81510687Seric int class; 81610687Seric char *word; 81710687Seric { 81810687Seric register STAB *s; 81910687Seric 82010687Seric s = stab(word, ST_CLASS, ST_ENTER); 82110687Seric setbitn(class, s->s_class); 82210687Seric } 823