122709Sdist /* 234921Sbostic * Copyright (c) 1983 Eric P. Allman 362530Sbostic * Copyright (c) 1988, 1993 462530Sbostic * The Regents of the University of California. All rights reserved. 533731Sbostic * 642829Sbostic * %sccs.include.redist.c% 733731Sbostic */ 822709Sdist 922709Sdist #ifndef lint 10*67896Seric static char sccsid[] = "@(#)readcf.c 8.45 (Berkeley) 11/08/94"; 1133731Sbostic #endif /* not lint */ 1222709Sdist 133313Seric # include "sendmail.h" 1464133Seric # include <pwd.h> 1564133Seric # include <grp.h> 1666334Seric #if NAMED_BIND 1757207Seric # include <resolv.h> 1857207Seric #endif 193308Seric 203308Seric /* 213308Seric ** READCF -- read control file. 223308Seric ** 233308Seric ** This routine reads the control file and builds the internal 243308Seric ** form. 253308Seric ** 264432Seric ** The file is formatted as a sequence of lines, each taken 274432Seric ** atomically. The first character of each line describes how 284432Seric ** the line is to be interpreted. The lines are: 294432Seric ** Dxval Define macro x to have value val. 304432Seric ** Cxword Put word into class x. 314432Seric ** Fxfile [fmt] Read file for lines to put into 324432Seric ** class x. Use scanf string 'fmt' 334432Seric ** or "%s" if not present. Fmt should 344432Seric ** only produce one string-valued result. 354432Seric ** Hname: value Define header with field-name 'name' 364432Seric ** and value as specified; this will be 374432Seric ** macro expanded immediately before 384432Seric ** use. 394432Seric ** Sn Use rewriting set n. 404432Seric ** Rlhs rhs Rewrite addresses that match lhs to 414432Seric ** be rhs. 4224944Seric ** Mn arg=val... Define mailer. n is the internal name. 4324944Seric ** Args specify mailer parameters. 448252Seric ** Oxvalue Set option x to value. 458252Seric ** Pname=value Set precedence name to value. 4664718Seric ** Vversioncode[/vendorcode] 4764718Seric ** Version level/vendor name of 4864718Seric ** configuration syntax. 4953654Seric ** Kmapname mapclass arguments.... 5053654Seric ** Define keyed lookup of a given class. 5153654Seric ** Arguments are class dependent. 524432Seric ** 533308Seric ** Parameters: 543308Seric ** cfname -- control file name. 5554973Seric ** safe -- TRUE if this is the system config file; 5654973Seric ** FALSE otherwise. 5755012Seric ** e -- the main envelope. 583308Seric ** 593308Seric ** Returns: 603308Seric ** none. 613308Seric ** 623308Seric ** Side Effects: 633308Seric ** Builds several internal tables. 643308Seric */ 653308Seric 6655012Seric readcf(cfname, safe, e) 673308Seric char *cfname; 6854973Seric bool safe; 6955012Seric register ENVELOPE *e; 703308Seric { 713308Seric FILE *cf; 728547Seric int ruleset = 0; 738547Seric char *q; 749350Seric struct rewrite *rwp = NULL; 7557135Seric char *bp; 7664718Seric auto char *ep; 7757589Seric int nfuzzy; 7864133Seric char *file; 7964133Seric bool optional; 8067769Seric int mid; 813308Seric char buf[MAXLINE]; 823308Seric register char *p; 833308Seric extern char **copyplist(); 8452647Seric struct stat statb; 855909Seric char exbuf[MAXLINE]; 8665066Seric char pvpbuf[MAXLINE + MAXATOM]; 8767826Seric static char *null_list[1] = { NULL }; 8810709Seric extern char *munchstring(); 8953654Seric extern void makemapentry(); 903308Seric 9152647Seric FileName = cfname; 9252647Seric LineNumber = 0; 9352647Seric 943308Seric cf = fopen(cfname, "r"); 953308Seric if (cf == NULL) 963308Seric { 9752647Seric syserr("cannot open"); 983308Seric exit(EX_OSFILE); 993308Seric } 1003308Seric 10152647Seric if (fstat(fileno(cf), &statb) < 0) 10252647Seric { 10352647Seric syserr("cannot fstat"); 10452647Seric exit(EX_OSFILE); 10552647Seric } 10652647Seric 10752647Seric if (!S_ISREG(statb.st_mode)) 10852647Seric { 10952647Seric syserr("not a plain file"); 11052647Seric exit(EX_OSFILE); 11152647Seric } 11252647Seric 11352647Seric if (OpMode != MD_TEST && bitset(S_IWGRP|S_IWOTH, statb.st_mode)) 11452647Seric { 11553037Seric if (OpMode == MD_DAEMON || OpMode == MD_FREEZE) 11653037Seric fprintf(stderr, "%s: WARNING: dangerous write permissions\n", 11753037Seric FileName); 11853037Seric #ifdef LOG 11953037Seric if (LogLevel > 0) 12053037Seric syslog(LOG_CRIT, "%s: WARNING: dangerous write permissions", 12153037Seric FileName); 12253037Seric #endif 12352647Seric } 12452647Seric 12559254Seric #ifdef XLA 12659254Seric xla_zero(); 12759254Seric #endif 12859254Seric 12957135Seric while ((bp = fgetfolded(buf, sizeof buf, cf)) != NULL) 1303308Seric { 13157135Seric if (bp[0] == '#') 13257135Seric { 13357135Seric if (bp != buf) 13457135Seric free(bp); 13552637Seric continue; 13657135Seric } 13752637Seric 13867769Seric /* do macro expansion mappings */ 13957135Seric for (p = bp; *p != '\0'; p++) 14016157Seric { 14157135Seric if (*p == '#' && p > bp && ConfigLevel >= 3) 14252647Seric { 14352647Seric /* this is an on-line comment */ 14452647Seric register char *e; 14552647Seric 14658050Seric switch (*--p & 0377) 14752647Seric { 14858050Seric case MACROEXPAND: 14952647Seric /* it's from $# -- let it go through */ 15052647Seric p++; 15152647Seric break; 15252647Seric 15352647Seric case '\\': 15452647Seric /* it's backslash escaped */ 15552647Seric (void) strcpy(p, p + 1); 15652647Seric break; 15752647Seric 15852647Seric default: 15952647Seric /* delete preceeding white space */ 16058050Seric while (isascii(*p) && isspace(*p) && p > bp) 16152647Seric p--; 16256795Seric if ((e = strchr(++p, '\n')) != NULL) 16352647Seric (void) strcpy(p, e); 16452647Seric else 16552647Seric p[0] = p[1] = '\0'; 16652647Seric break; 16752647Seric } 16852647Seric continue; 16952647Seric } 17052647Seric 17167769Seric if (*p != '$' || p[1] == '\0') 17216157Seric continue; 17316157Seric 17416157Seric if (p[1] == '$') 17516157Seric { 17616157Seric /* actual dollar sign.... */ 17723111Seric (void) strcpy(p, p + 1); 17816157Seric continue; 17916157Seric } 18016157Seric 18116157Seric /* convert to macro expansion character */ 18267769Seric *p++ = MACROEXPAND; 18367769Seric 18467769Seric /* convert macro name to code */ 18567769Seric *p = macid(p, &ep); 18667769Seric if (ep != p) 18767769Seric strcpy(p + 1, ep); 18816157Seric } 18916157Seric 19016157Seric /* interpret this line */ 19164718Seric errno = 0; 19257135Seric switch (bp[0]) 1933308Seric { 1943308Seric case '\0': 1953308Seric case '#': /* comment */ 1963308Seric break; 1973308Seric 1983308Seric case 'R': /* rewriting rule */ 19957135Seric for (p = &bp[1]; *p != '\0' && *p != '\t'; p++) 2003308Seric continue; 2013308Seric 2023308Seric if (*p == '\0') 2035909Seric { 20465821Seric syserr("invalid rewrite line \"%s\" (tab expected)", bp); 2055909Seric break; 2065909Seric } 2075909Seric 2085909Seric /* allocate space for the rule header */ 2095909Seric if (rwp == NULL) 2105909Seric { 2115909Seric RewriteRules[ruleset] = rwp = 2125909Seric (struct rewrite *) xalloc(sizeof *rwp); 2135909Seric } 2143308Seric else 2153308Seric { 2165909Seric rwp->r_next = (struct rewrite *) xalloc(sizeof *rwp); 2175909Seric rwp = rwp->r_next; 2185909Seric } 2195909Seric rwp->r_next = NULL; 2203308Seric 2215909Seric /* expand and save the LHS */ 2225909Seric *p = '\0'; 22357135Seric expand(&bp[1], exbuf, &exbuf[sizeof exbuf], e); 22465066Seric rwp->r_lhs = prescan(exbuf, '\t', pvpbuf, 22565066Seric sizeof pvpbuf, NULL); 22657589Seric nfuzzy = 0; 2275909Seric if (rwp->r_lhs != NULL) 22857589Seric { 22957589Seric register char **ap; 23057589Seric 2315909Seric rwp->r_lhs = copyplist(rwp->r_lhs, TRUE); 23257589Seric 23357589Seric /* count the number of fuzzy matches in LHS */ 23457589Seric for (ap = rwp->r_lhs; *ap != NULL; ap++) 23557589Seric { 23658148Seric char *botch; 23758148Seric 23858148Seric botch = NULL; 23958050Seric switch (**ap & 0377) 24057589Seric { 24157589Seric case MATCHZANY: 24257589Seric case MATCHANY: 24357589Seric case MATCHONE: 24457589Seric case MATCHCLASS: 24557589Seric case MATCHNCLASS: 24657589Seric nfuzzy++; 24758148Seric break; 24858148Seric 24958148Seric case MATCHREPL: 25058148Seric botch = "$0-$9"; 25158148Seric break; 25258148Seric 25358148Seric case CANONNET: 25458148Seric botch = "$#"; 25558148Seric break; 25658148Seric 25758148Seric case CANONUSER: 25858148Seric botch = "$:"; 25958148Seric break; 26058148Seric 26158148Seric case CALLSUBR: 26258148Seric botch = "$>"; 26358148Seric break; 26458148Seric 26558148Seric case CONDIF: 26658148Seric botch = "$?"; 26758148Seric break; 26858148Seric 26958148Seric case CONDELSE: 27058148Seric botch = "$|"; 27158148Seric break; 27258148Seric 27358148Seric case CONDFI: 27458148Seric botch = "$."; 27558148Seric break; 27658148Seric 27758148Seric case HOSTBEGIN: 27858148Seric botch = "$["; 27958148Seric break; 28058148Seric 28158148Seric case HOSTEND: 28258148Seric botch = "$]"; 28358148Seric break; 28458148Seric 28558148Seric case LOOKUPBEGIN: 28658148Seric botch = "$("; 28758148Seric break; 28858148Seric 28958148Seric case LOOKUPEND: 29058148Seric botch = "$)"; 29158148Seric break; 29257589Seric } 29358148Seric if (botch != NULL) 29458148Seric syserr("Inappropriate use of %s on LHS", 29558148Seric botch); 29657589Seric } 29757589Seric } 29856678Seric else 29967826Seric { 30056678Seric syserr("R line: null LHS"); 30167826Seric rwp->r_lhs = null_list; 30267826Seric } 3035909Seric 3045909Seric /* expand and save the RHS */ 3055909Seric while (*++p == '\t') 3065909Seric continue; 3077231Seric q = p; 3087231Seric while (*p != '\0' && *p != '\t') 3097231Seric p++; 3107231Seric *p = '\0'; 31155012Seric expand(q, exbuf, &exbuf[sizeof exbuf], e); 31265066Seric rwp->r_rhs = prescan(exbuf, '\t', pvpbuf, 31365066Seric sizeof pvpbuf, NULL); 3145909Seric if (rwp->r_rhs != NULL) 31557589Seric { 31657589Seric register char **ap; 31757589Seric 3185909Seric rwp->r_rhs = copyplist(rwp->r_rhs, TRUE); 31957589Seric 32057589Seric /* check no out-of-bounds replacements */ 32157589Seric nfuzzy += '0'; 32257589Seric for (ap = rwp->r_rhs; *ap != NULL; ap++) 32357589Seric { 32458148Seric char *botch; 32558148Seric 32658148Seric botch = NULL; 32758148Seric switch (**ap & 0377) 32857589Seric { 32958148Seric case MATCHREPL: 33058148Seric if ((*ap)[1] <= '0' || (*ap)[1] > nfuzzy) 33158148Seric { 33258148Seric syserr("replacement $%c out of bounds", 33358148Seric (*ap)[1]); 33458148Seric } 33558148Seric break; 33658148Seric 33758148Seric case MATCHZANY: 33858148Seric botch = "$*"; 33958148Seric break; 34058148Seric 34158148Seric case MATCHANY: 34258148Seric botch = "$+"; 34358148Seric break; 34458148Seric 34558148Seric case MATCHONE: 34658148Seric botch = "$-"; 34758148Seric break; 34858148Seric 34958148Seric case MATCHCLASS: 35058148Seric botch = "$="; 35158148Seric break; 35258148Seric 35358148Seric case MATCHNCLASS: 35458148Seric botch = "$~"; 35558148Seric break; 35657589Seric } 35758148Seric if (botch != NULL) 35858148Seric syserr("Inappropriate use of %s on RHS", 35958148Seric botch); 36057589Seric } 36157589Seric } 36256678Seric else 36367826Seric { 36456678Seric syserr("R line: null RHS"); 36567826Seric rwp->r_rhs = null_list; 36667826Seric } 3673308Seric break; 3683308Seric 3694072Seric case 'S': /* select rewriting set */ 37064440Seric for (p = &bp[1]; isascii(*p) && isspace(*p); p++) 37164440Seric continue; 37264440Seric if (!isascii(*p) || !isdigit(*p)) 37364440Seric { 37464440Seric syserr("invalid argument to S line: \"%.20s\"", 37564440Seric &bp[1]); 37664440Seric break; 37764440Seric } 37864440Seric ruleset = atoi(p); 3798056Seric if (ruleset >= MAXRWSETS || ruleset < 0) 3808056Seric { 3819381Seric syserr("bad ruleset %d (%d max)", ruleset, MAXRWSETS); 3828056Seric ruleset = 0; 3838056Seric } 3844072Seric rwp = NULL; 3854072Seric break; 3864072Seric 3873308Seric case 'D': /* macro definition */ 38867769Seric mid = macid(&bp[1], &ep); 38967769Seric p = munchstring(ep, NULL); 39067769Seric define(mid, newstr(p), e); 3913308Seric break; 3923308Seric 3933387Seric case 'H': /* required header line */ 39457135Seric (void) chompheader(&bp[1], TRUE, e); 3953387Seric break; 3963387Seric 3974061Seric case 'C': /* word class */ 3984432Seric /* scan the list of words and set class for all */ 39967769Seric mid = macid(&bp[1], &ep); 40067769Seric expand(ep, exbuf, &exbuf[sizeof exbuf], e); 40164121Seric for (p = exbuf; *p != '\0'; ) 4024061Seric { 4034061Seric register char *wd; 4044061Seric char delim; 4054061Seric 40658050Seric while (*p != '\0' && isascii(*p) && isspace(*p)) 4074061Seric p++; 4084061Seric wd = p; 40958050Seric while (*p != '\0' && !(isascii(*p) && isspace(*p))) 4104061Seric p++; 4114061Seric delim = *p; 4124061Seric *p = '\0'; 4134061Seric if (wd[0] != '\0') 41467769Seric setclass(mid, wd); 4154061Seric *p = delim; 4164061Seric } 4174061Seric break; 4184061Seric 41959272Seric case 'F': /* word class from file */ 42067769Seric mid = macid(&bp[1], &ep); 42167769Seric for (p = ep; isascii(*p) && isspace(*p); ) 42264133Seric p++; 42364133Seric if (p[0] == '-' && p[1] == 'o') 42464133Seric { 42564133Seric optional = TRUE; 42664133Seric while (*p != '\0' && !(isascii(*p) && isspace(*p))) 42764133Seric p++; 42864133Seric while (isascii(*p) && isspace(*p)) 42967615Seric p++; 43064133Seric } 43164133Seric else 43264133Seric optional = FALSE; 43364133Seric file = p; 43464133Seric while (*p != '\0' && !(isascii(*p) && isspace(*p))) 43564133Seric p++; 43659272Seric if (*p == '\0') 43759272Seric p = "%s"; 43859272Seric else 43959272Seric { 44059272Seric *p = '\0'; 44159272Seric while (isascii(*++p) && isspace(*p)) 44259272Seric continue; 44359272Seric } 44464133Seric fileclass(bp[1], file, p, safe, optional); 44559272Seric break; 44659272Seric 44759156Seric #ifdef XLA 44859156Seric case 'L': /* extended load average description */ 44959156Seric xla_init(&bp[1]); 45059156Seric break; 45159156Seric #endif 45259156Seric 4534096Seric case 'M': /* define mailer */ 45457135Seric makemailer(&bp[1]); 4554096Seric break; 4564096Seric 4578252Seric case 'O': /* set option */ 45858734Seric setoption(bp[1], &bp[2], safe, FALSE, e); 4598252Seric break; 4608252Seric 4618252Seric case 'P': /* set precedence */ 4628252Seric if (NumPriorities >= MAXPRIORITIES) 4638252Seric { 4648547Seric toomany('P', MAXPRIORITIES); 4658252Seric break; 4668252Seric } 46757135Seric for (p = &bp[1]; *p != '\0' && *p != '=' && *p != '\t'; p++) 4688252Seric continue; 4698252Seric if (*p == '\0') 4708252Seric goto badline; 4718252Seric *p = '\0'; 47257135Seric Priorities[NumPriorities].pri_name = newstr(&bp[1]); 4738252Seric Priorities[NumPriorities].pri_val = atoi(++p); 4748252Seric NumPriorities++; 4758252Seric break; 4768252Seric 4778547Seric case 'T': /* trusted user(s) */ 47858161Seric /* this option is obsolete, but will be ignored */ 4798547Seric break; 4808547Seric 48152645Seric case 'V': /* configuration syntax version */ 48264440Seric for (p = &bp[1]; isascii(*p) && isspace(*p); p++) 48364440Seric continue; 48464440Seric if (!isascii(*p) || !isdigit(*p)) 48564440Seric { 48664440Seric syserr("invalid argument to V line: \"%.20s\"", 48764440Seric &bp[1]); 48864440Seric break; 48964440Seric } 49064718Seric ConfigLevel = strtol(p, &ep, 10); 49164279Seric if (ConfigLevel >= 5) 49264279Seric { 49364279Seric /* level 5 configs have short name in $w */ 49464279Seric p = macvalue('w', e); 49564279Seric if (p != NULL && (p = strchr(p, '.')) != NULL) 49664279Seric *p = '\0'; 49764279Seric } 49864718Seric if (*ep++ == '/') 49964718Seric { 50064718Seric /* extract vendor code */ 50164718Seric for (p = ep; isascii(*p) && isalpha(*p); ) 50264718Seric p++; 50364718Seric *p = '\0'; 50464718Seric 50564718Seric if (!setvendor(ep)) 50664718Seric syserr("invalid V line vendor code: \"%s\"", 50764718Seric ep); 50864718Seric } 50952645Seric break; 51052645Seric 51153654Seric case 'K': 51257135Seric makemapentry(&bp[1]); 51353654Seric break; 51453654Seric 5153308Seric default: 5164061Seric badline: 51757135Seric syserr("unknown control line \"%s\"", bp); 5183308Seric } 51957135Seric if (bp != buf) 52057135Seric free(bp); 5213308Seric } 52252637Seric if (ferror(cf)) 52352637Seric { 52452647Seric syserr("I/O read error", cfname); 52552637Seric exit(EX_OSFILE); 52652637Seric } 52752637Seric fclose(cf); 5289381Seric FileName = NULL; 52956836Seric 53067730Seric /* initialize host maps from local service tables */ 53167730Seric inithostmaps(); 5324096Seric } 5334096Seric /* 5348547Seric ** TOOMANY -- signal too many of some option 5358547Seric ** 5368547Seric ** Parameters: 5378547Seric ** id -- the id of the error line 5388547Seric ** maxcnt -- the maximum possible values 5398547Seric ** 5408547Seric ** Returns: 5418547Seric ** none. 5428547Seric ** 5438547Seric ** Side Effects: 5448547Seric ** gives a syserr. 5458547Seric */ 5468547Seric 5478547Seric toomany(id, maxcnt) 5488547Seric char id; 5498547Seric int maxcnt; 5508547Seric { 5519381Seric syserr("too many %c lines, %d max", id, maxcnt); 5528547Seric } 5538547Seric /* 5544432Seric ** FILECLASS -- read members of a class from a file 5554432Seric ** 5564432Seric ** Parameters: 5574432Seric ** class -- class to define. 5584432Seric ** filename -- name of file to read. 5594432Seric ** fmt -- scanf string to use for match. 56064133Seric ** safe -- if set, this is a safe read. 56164133Seric ** optional -- if set, it is not an error for the file to 56264133Seric ** not exist. 5634432Seric ** 5644432Seric ** Returns: 5654432Seric ** none 5664432Seric ** 5674432Seric ** Side Effects: 5684432Seric ** 5694432Seric ** puts all lines in filename that match a scanf into 5704432Seric ** the named class. 5714432Seric */ 5724432Seric 57364133Seric fileclass(class, filename, fmt, safe, optional) 5744432Seric int class; 5754432Seric char *filename; 5764432Seric char *fmt; 57754973Seric bool safe; 57864133Seric bool optional; 5794432Seric { 58025808Seric FILE *f; 58154973Seric struct stat stbuf; 5824432Seric char buf[MAXLINE]; 5834432Seric 58466101Seric if (tTd(37, 2)) 58566101Seric printf("fileclass(%s, fmt=%s)\n", filename, fmt); 58666101Seric 58766031Seric if (filename[0] == '|') 58866031Seric { 58966031Seric syserr("fileclass: pipes (F%c%s) not supported due to security problems", 59066031Seric class, filename); 59166031Seric return; 59266031Seric } 59354973Seric if (stat(filename, &stbuf) < 0) 59454973Seric { 59566101Seric if (tTd(37, 2)) 59666101Seric printf(" cannot stat (%s)\n", errstring(errno)); 59764133Seric if (!optional) 59864133Seric syserr("fileclass: cannot stat %s", filename); 59954973Seric return; 60054973Seric } 60154973Seric if (!S_ISREG(stbuf.st_mode)) 60254973Seric { 60354973Seric syserr("fileclass: %s not a regular file", filename); 60454973Seric return; 60554973Seric } 60654973Seric if (!safe && access(filename, R_OK) < 0) 60754973Seric { 60854973Seric syserr("fileclass: access denied on %s", filename); 60954973Seric return; 61054973Seric } 61154973Seric f = fopen(filename, "r"); 6124432Seric if (f == NULL) 6134432Seric { 61454973Seric syserr("fileclass: cannot open %s", filename); 6154432Seric return; 6164432Seric } 6174432Seric 6184432Seric while (fgets(buf, sizeof buf, f) != NULL) 6194432Seric { 6204432Seric register STAB *s; 62125808Seric register char *p; 62225808Seric # ifdef SCANF 6234432Seric char wordbuf[MAXNAME+1]; 6244432Seric 6254432Seric if (sscanf(buf, fmt, wordbuf) != 1) 6264432Seric continue; 62725808Seric p = wordbuf; 62856795Seric # else /* SCANF */ 62925808Seric p = buf; 63056795Seric # endif /* SCANF */ 63125808Seric 63225808Seric /* 63325808Seric ** Break up the match into words. 63425808Seric */ 63525808Seric 63625808Seric while (*p != '\0') 63725808Seric { 63825808Seric register char *q; 63925808Seric 64025808Seric /* strip leading spaces */ 64158050Seric while (isascii(*p) && isspace(*p)) 64225808Seric p++; 64325808Seric if (*p == '\0') 64425808Seric break; 64525808Seric 64625808Seric /* find the end of the word */ 64725808Seric q = p; 64858050Seric while (*p != '\0' && !(isascii(*p) && isspace(*p))) 64925808Seric p++; 65025808Seric if (*p != '\0') 65125808Seric *p++ = '\0'; 65225808Seric 65325808Seric /* enter the word in the symbol table */ 65466101Seric setclass(class, q); 65525808Seric } 6564432Seric } 6574432Seric 65854973Seric (void) fclose(f); 6594432Seric } 6604432Seric /* 6614096Seric ** MAKEMAILER -- define a new mailer. 6624096Seric ** 6634096Seric ** Parameters: 66410327Seric ** line -- description of mailer. This is in labeled 66510327Seric ** fields. The fields are: 66610327Seric ** P -- the path to the mailer 66710327Seric ** F -- the flags associated with the mailer 66810327Seric ** A -- the argv for this mailer 66910327Seric ** S -- the sender rewriting set 67010327Seric ** R -- the recipient rewriting set 67110327Seric ** E -- the eol string 67210327Seric ** The first word is the canonical name of the mailer. 6734096Seric ** 6744096Seric ** Returns: 6754096Seric ** none. 6764096Seric ** 6774096Seric ** Side Effects: 6784096Seric ** enters the mailer into the mailer table. 6794096Seric */ 6803308Seric 68121066Seric makemailer(line) 6824096Seric char *line; 6834096Seric { 6844096Seric register char *p; 6858067Seric register struct mailer *m; 6868067Seric register STAB *s; 6878067Seric int i; 68810327Seric char fcode; 68958020Seric auto char *endp; 6904096Seric extern int NextMailer; 69110327Seric extern char **makeargv(); 69210327Seric extern char *munchstring(); 69310701Seric extern long atol(); 6944096Seric 69510327Seric /* allocate a mailer and set up defaults */ 69610327Seric m = (struct mailer *) xalloc(sizeof *m); 69710327Seric bzero((char *) m, sizeof *m); 69810327Seric m->m_eol = "\n"; 69967604Seric m->m_uid = m->m_gid = 0; 70010327Seric 70110327Seric /* collect the mailer name */ 70258050Seric for (p = line; *p != '\0' && *p != ',' && !(isascii(*p) && isspace(*p)); p++) 70310327Seric continue; 70410327Seric if (*p != '\0') 70510327Seric *p++ = '\0'; 70610327Seric m->m_name = newstr(line); 70710327Seric 70810327Seric /* now scan through and assign info from the fields */ 70910327Seric while (*p != '\0') 71010327Seric { 71158333Seric auto char *delimptr; 71258333Seric 71358050Seric while (*p != '\0' && (*p == ',' || (isascii(*p) && isspace(*p)))) 71410327Seric p++; 71510327Seric 71610327Seric /* p now points to field code */ 71710327Seric fcode = *p; 71810327Seric while (*p != '\0' && *p != '=' && *p != ',') 71910327Seric p++; 72010327Seric if (*p++ != '=') 72110327Seric { 72252637Seric syserr("mailer %s: `=' expected", m->m_name); 72310327Seric return; 72410327Seric } 72558050Seric while (isascii(*p) && isspace(*p)) 72610327Seric p++; 72710327Seric 72810327Seric /* p now points to the field body */ 72958333Seric p = munchstring(p, &delimptr); 73010327Seric 73110327Seric /* install the field into the mailer struct */ 73210327Seric switch (fcode) 73310327Seric { 73410327Seric case 'P': /* pathname */ 73510327Seric m->m_mailer = newstr(p); 73610327Seric break; 73710327Seric 73810327Seric case 'F': /* flags */ 73910687Seric for (; *p != '\0'; p++) 74058050Seric if (!(isascii(*p) && isspace(*p))) 74152637Seric setbitn(*p, m->m_flags); 74210327Seric break; 74310327Seric 74410327Seric case 'S': /* sender rewriting ruleset */ 74510327Seric case 'R': /* recipient rewriting ruleset */ 74658020Seric i = strtol(p, &endp, 10); 74710327Seric if (i < 0 || i >= MAXRWSETS) 74810327Seric { 74910327Seric syserr("invalid rewrite set, %d max", MAXRWSETS); 75010327Seric return; 75110327Seric } 75210327Seric if (fcode == 'S') 75358020Seric m->m_sh_rwset = m->m_se_rwset = i; 75410327Seric else 75558020Seric m->m_rh_rwset = m->m_re_rwset = i; 75658020Seric 75758020Seric p = endp; 75859985Seric if (*p++ == '/') 75958020Seric { 76058020Seric i = strtol(p, NULL, 10); 76158020Seric if (i < 0 || i >= MAXRWSETS) 76258020Seric { 76358020Seric syserr("invalid rewrite set, %d max", 76458020Seric MAXRWSETS); 76558020Seric return; 76658020Seric } 76758020Seric if (fcode == 'S') 76858020Seric m->m_sh_rwset = i; 76958020Seric else 77058020Seric m->m_rh_rwset = i; 77158020Seric } 77210327Seric break; 77310327Seric 77410327Seric case 'E': /* end of line string */ 77510327Seric m->m_eol = newstr(p); 77610327Seric break; 77710327Seric 77810327Seric case 'A': /* argument vector */ 77910327Seric m->m_argv = makeargv(p); 78010327Seric break; 78110701Seric 78210701Seric case 'M': /* maximum message size */ 78310701Seric m->m_maxsize = atol(p); 78410701Seric break; 78552106Seric 78652106Seric case 'L': /* maximum line length */ 78752106Seric m->m_linelimit = atoi(p); 78852106Seric break; 78958935Seric 79058935Seric case 'D': /* working directory */ 79158935Seric m->m_execdir = newstr(p); 79258935Seric break; 79367604Seric 794*67896Seric case 'C': /* default charset */ 795*67896Seric m->m_defcharset = newstr(p); 796*67896Seric break; 797*67896Seric 79867604Seric case 'U': /* user id */ 79967604Seric if (isascii(*p) && !isdigit(*p)) 80067604Seric { 80167604Seric char *q = p; 80267604Seric struct passwd *pw; 80367604Seric 80467604Seric while (isascii(*p) && isalnum(*p)) 80567604Seric p++; 80667604Seric while (isascii(*p) && isspace(*p)) 80767604Seric *p++ = '\0'; 80867604Seric if (*p != '\0') 80967604Seric *p++ = '\0'; 81067604Seric pw = getpwnam(q); 81167604Seric if (pw == NULL) 81267604Seric syserr("readcf: mailer U= flag: unknown user %s", q); 81367604Seric else 81467604Seric { 81567604Seric m->m_uid = pw->pw_uid; 81667604Seric m->m_gid = pw->pw_gid; 81767604Seric } 81867604Seric } 81967604Seric else 82067604Seric { 82167604Seric auto char *q; 82267604Seric 82367604Seric m->m_uid = strtol(p, &q, 0); 82467604Seric p = q; 82567604Seric } 82667604Seric while (isascii(*p) && isspace(*p)) 82767604Seric p++; 82867604Seric if (*p == '\0') 82967604Seric break; 83067604Seric if (isascii(*p) && !isdigit(*p)) 83167604Seric { 83267604Seric char *q = p; 83367604Seric struct group *gr; 83467604Seric 83567604Seric while (isascii(*p) && isalnum(*p)) 83667604Seric p++; 83767604Seric *p++ = '\0'; 83867604Seric gr = getgrnam(q); 83967604Seric if (gr == NULL) 84067604Seric syserr("readcf: mailer U= flag: unknown group %s", q); 84167604Seric else 84267604Seric m->m_gid = gr->gr_gid; 84367604Seric } 84467604Seric else 84567604Seric { 84667604Seric m->m_gid = strtol(p, NULL, 0); 84767604Seric } 84867604Seric break; 84910327Seric } 85010327Seric 85158333Seric p = delimptr; 85210327Seric } 85310327Seric 85452106Seric /* do some heuristic cleanup for back compatibility */ 85552106Seric if (bitnset(M_LIMITS, m->m_flags)) 85652106Seric { 85752106Seric if (m->m_linelimit == 0) 85852106Seric m->m_linelimit = SMTPLINELIM; 85955418Seric if (ConfigLevel < 2) 86052106Seric setbitn(M_7BITS, m->m_flags); 86152106Seric } 86252106Seric 86358321Seric /* do some rationality checking */ 86458321Seric if (m->m_argv == NULL) 86558321Seric { 86658321Seric syserr("M%s: A= argument required", m->m_name); 86758321Seric return; 86858321Seric } 86958321Seric if (m->m_mailer == NULL) 87058321Seric { 87158321Seric syserr("M%s: P= argument required", m->m_name); 87258321Seric return; 87358321Seric } 87458321Seric 8754096Seric if (NextMailer >= MAXMAILERS) 8764096Seric { 8779381Seric syserr("too many mailers defined (%d max)", MAXMAILERS); 8784096Seric return; 8794096Seric } 88057402Seric 88110327Seric s = stab(m->m_name, ST_MAILER, ST_ENTER); 88257402Seric if (s->s_mailer != NULL) 88357402Seric { 88457402Seric i = s->s_mailer->m_mno; 88557402Seric free(s->s_mailer); 88657402Seric } 88757402Seric else 88857402Seric { 88957402Seric i = NextMailer++; 89057402Seric } 89157402Seric Mailer[i] = s->s_mailer = m; 89257454Seric m->m_mno = i; 89310327Seric } 89410327Seric /* 89510327Seric ** MUNCHSTRING -- translate a string into internal form. 89610327Seric ** 89710327Seric ** Parameters: 89810327Seric ** p -- the string to munch. 89958333Seric ** delimptr -- if non-NULL, set to the pointer of the 90058333Seric ** field delimiter character. 90110327Seric ** 90210327Seric ** Returns: 90310327Seric ** the munched string. 90410327Seric */ 9054096Seric 90610327Seric char * 90758333Seric munchstring(p, delimptr) 90810327Seric register char *p; 90958333Seric char **delimptr; 91010327Seric { 91110327Seric register char *q; 91210327Seric bool backslash = FALSE; 91310327Seric bool quotemode = FALSE; 91410327Seric static char buf[MAXLINE]; 9154096Seric 91610327Seric for (q = buf; *p != '\0'; p++) 9174096Seric { 91810327Seric if (backslash) 91910327Seric { 92010327Seric /* everything is roughly literal */ 92110357Seric backslash = FALSE; 92210327Seric switch (*p) 92310327Seric { 92410327Seric case 'r': /* carriage return */ 92510327Seric *q++ = '\r'; 92610327Seric continue; 92710327Seric 92810327Seric case 'n': /* newline */ 92910327Seric *q++ = '\n'; 93010327Seric continue; 93110327Seric 93210327Seric case 'f': /* form feed */ 93310327Seric *q++ = '\f'; 93410327Seric continue; 93510327Seric 93610327Seric case 'b': /* backspace */ 93710327Seric *q++ = '\b'; 93810327Seric continue; 93910327Seric } 94010327Seric *q++ = *p; 94110327Seric } 94210327Seric else 94310327Seric { 94410327Seric if (*p == '\\') 94510327Seric backslash = TRUE; 94610327Seric else if (*p == '"') 94710327Seric quotemode = !quotemode; 94810327Seric else if (quotemode || *p != ',') 94910327Seric *q++ = *p; 95010327Seric else 95110327Seric break; 95210327Seric } 9534096Seric } 9544096Seric 95558333Seric if (delimptr != NULL) 95658333Seric *delimptr = p; 95710327Seric *q++ = '\0'; 95810327Seric return (buf); 95910327Seric } 96010327Seric /* 96110327Seric ** MAKEARGV -- break up a string into words 96210327Seric ** 96310327Seric ** Parameters: 96410327Seric ** p -- the string to break up. 96510327Seric ** 96610327Seric ** Returns: 96710327Seric ** a char **argv (dynamically allocated) 96810327Seric ** 96910327Seric ** Side Effects: 97010327Seric ** munges p. 97110327Seric */ 9724096Seric 97310327Seric char ** 97410327Seric makeargv(p) 97510327Seric register char *p; 97610327Seric { 97710327Seric char *q; 97810327Seric int i; 97910327Seric char **avp; 98010327Seric char *argv[MAXPV + 1]; 98110327Seric 98210327Seric /* take apart the words */ 98310327Seric i = 0; 98410327Seric while (*p != '\0' && i < MAXPV) 9854096Seric { 98610327Seric q = p; 98758050Seric while (*p != '\0' && !(isascii(*p) && isspace(*p))) 98810327Seric p++; 98958050Seric while (isascii(*p) && isspace(*p)) 99010327Seric *p++ = '\0'; 99110327Seric argv[i++] = newstr(q); 9924096Seric } 99310327Seric argv[i++] = NULL; 9944096Seric 99510327Seric /* now make a copy of the argv */ 99610327Seric avp = (char **) xalloc(sizeof *avp * i); 99716893Seric bcopy((char *) argv, (char *) avp, sizeof *avp * i); 99810327Seric 99910327Seric return (avp); 10003308Seric } 10013308Seric /* 10023308Seric ** PRINTRULES -- print rewrite rules (for debugging) 10033308Seric ** 10043308Seric ** Parameters: 10053308Seric ** none. 10063308Seric ** 10073308Seric ** Returns: 10083308Seric ** none. 10093308Seric ** 10103308Seric ** Side Effects: 10113308Seric ** prints rewrite rules. 10123308Seric */ 10133308Seric 10143308Seric printrules() 10153308Seric { 10163308Seric register struct rewrite *rwp; 10174072Seric register int ruleset; 10183308Seric 10194072Seric for (ruleset = 0; ruleset < 10; ruleset++) 10203308Seric { 10214072Seric if (RewriteRules[ruleset] == NULL) 10224072Seric continue; 10238067Seric printf("\n----Rule Set %d:", ruleset); 10243308Seric 10254072Seric for (rwp = RewriteRules[ruleset]; rwp != NULL; rwp = rwp->r_next) 10263308Seric { 10278067Seric printf("\nLHS:"); 10288067Seric printav(rwp->r_lhs); 10298067Seric printf("RHS:"); 10308067Seric printav(rwp->r_rhs); 10313308Seric } 10323308Seric } 10333308Seric } 10344319Seric 10354096Seric /* 10368256Seric ** SETOPTION -- set global processing option 10378256Seric ** 10388256Seric ** Parameters: 10398256Seric ** opt -- option name. 10408256Seric ** val -- option value (as a text string). 104121755Seric ** safe -- set if this came from a configuration file. 104221755Seric ** Some options (if set from the command line) will 104321755Seric ** reset the user id to avoid security problems. 10448269Seric ** sticky -- if set, don't let other setoptions override 10458269Seric ** this value. 104658734Seric ** e -- the main envelope. 10478256Seric ** 10488256Seric ** Returns: 10498256Seric ** none. 10508256Seric ** 10518256Seric ** Side Effects: 10528256Seric ** Sets options as implied by the arguments. 10538256Seric */ 10548256Seric 105510687Seric static BITMAP StickyOpt; /* set if option is stuck */ 10568269Seric 105757207Seric 105866334Seric #if NAMED_BIND 105957207Seric 106057207Seric struct resolverflags 106157207Seric { 106257207Seric char *rf_name; /* name of the flag */ 106357207Seric long rf_bits; /* bits to set/clear */ 106457207Seric } ResolverFlags[] = 106557207Seric { 106657207Seric "debug", RES_DEBUG, 106757207Seric "aaonly", RES_AAONLY, 106857207Seric "usevc", RES_USEVC, 106957207Seric "primary", RES_PRIMARY, 107057207Seric "igntc", RES_IGNTC, 107157207Seric "recurse", RES_RECURSE, 107257207Seric "defnames", RES_DEFNAMES, 107357207Seric "stayopen", RES_STAYOPEN, 107457207Seric "dnsrch", RES_DNSRCH, 107565583Seric "true", 0, /* to avoid error on old syntax */ 107657207Seric NULL, 0 107757207Seric }; 107857207Seric 107957207Seric #endif 108057207Seric 108167614Seric struct optioninfo 108267614Seric { 108367614Seric char *o_name; /* long name of option */ 108467787Seric u_char o_code; /* short name of option */ 108567614Seric bool o_safe; /* safe for random people to use */ 108667614Seric } OptionTab[] = 108767614Seric { 108867707Seric "SevenBitInput", '7', TRUE, 108967707Seric "EightBitMode", '8', TRUE, 109067707Seric "AliasFile", 'A', FALSE, 109167707Seric "AliasWait", 'a', FALSE, 109267707Seric "BlankSub", 'B', FALSE, 109367707Seric "MinFreeBlocks", 'b', TRUE, 109467707Seric "CheckpointInterval", 'C', TRUE, 109567707Seric "HoldExpensive", 'c', FALSE, 109667707Seric "AutoRebuildAliases", 'D', FALSE, 109767707Seric "DeliveryMode", 'd', TRUE, 109867707Seric "ErrorHeader", 'E', FALSE, 109967707Seric "ErrorMode", 'e', TRUE, 110067707Seric "TempFileMode", 'F', FALSE, 110167707Seric "SaveFromLine", 'f', FALSE, 110267707Seric "MatchGECOS", 'G', FALSE, 110367707Seric "HelpFile", 'H', FALSE, 110467707Seric "MaxHopCount", 'h', FALSE, 110567707Seric "NameServerOptions", 'I', FALSE, 110667707Seric "IgnoreDots", 'i', TRUE, 110767707Seric "ForwardPath", 'J', FALSE, 110867707Seric "SendMimeErrors", 'j', TRUE, 110967707Seric "ConnectionCacheSize", 'k', FALSE, 111067707Seric "ConnectionCacheTimeout", 'K', FALSE, 111167707Seric "UseErrorsTo", 'l', FALSE, 111267707Seric "LogLevel", 'L', FALSE, 111367707Seric "MeToo", 'm', TRUE, 111467707Seric "CheckAliases", 'n', FALSE, 111567707Seric "OldStyleHeaders", 'o', TRUE, 111667707Seric "DaemonPortOptions", 'O', FALSE, 111767707Seric "PrivacyOptions", 'p', TRUE, 111867707Seric "PostmasterCopy", 'P', FALSE, 111967707Seric "QueueFactor", 'q', FALSE, 112067707Seric "QueueDirectory", 'Q', FALSE, 112167707Seric "DontPruneRoutes", 'R', FALSE, 112267711Seric "Timeouts", 'r', TRUE, 112367707Seric "StatusFile", 'S', FALSE, 112467707Seric "SuperSafe", 's', TRUE, 112567707Seric "QueueTimeout", 'T', FALSE, 112667707Seric "TimeZoneSpec", 't', FALSE, 112767707Seric "UserDatabaseSpec", 'U', FALSE, 112867707Seric "DefaultUser", 'u', FALSE, 112967707Seric "FallbackMXhost", 'V', FALSE, 113067707Seric "Verbose", 'v', TRUE, 113167707Seric "TryNullMXList", 'w', TRUE, 113267707Seric "QueueLA", 'x', FALSE, 113367707Seric "RefuseLA", 'X', FALSE, 113467707Seric "RecipientFactor", 'y', FALSE, 113567707Seric "ForkQueueRuns", 'Y', FALSE, 113667707Seric "ClassFactor", 'z', FALSE, 113767707Seric "TimeFactor", 'Z', FALSE, 113867707Seric #define O_BSP 0x80 113967707Seric "BrokenSmtpPeers", O_BSP, TRUE, 114067707Seric #define O_SQBH 0x81 114167707Seric "SortQueueByHost", O_SQBH, TRUE, 114267707Seric #define O_DNICE 0x82 114367707Seric "DeliveryNiceness", O_DNICE, TRUE, 114467707Seric #define O_MQA 0x83 114567707Seric "MinQueueAge", O_MQA, TRUE, 114667707Seric #define O_MHSA 0x84 114767707Seric "MaxHostStatAge", O_MHSA, TRUE, 114867813Seric #define O_DEFCHARSET 0x85 114967813Seric "DefaultCharSet", O_DEFCHARSET, TRUE, 115067848Seric #define O_SSFILE 0x86 115167848Seric "ServiceSwitchFile", O_SSFILE, FALSE, 115267707Seric 115367707Seric NULL, '\0', FALSE, 115467614Seric }; 115567614Seric 115667614Seric 115767614Seric 115858734Seric setoption(opt, val, safe, sticky, e) 115967614Seric u_char opt; 11608256Seric char *val; 116121755Seric bool safe; 11628269Seric bool sticky; 116358734Seric register ENVELOPE *e; 11648256Seric { 116557207Seric register char *p; 116667614Seric register struct optioninfo *o; 11678265Seric extern bool atobool(); 116812633Seric extern time_t convtime(); 116914879Seric extern int QueueLA; 117014879Seric extern int RefuseLA; 117164718Seric extern bool Warn_Q_option; 11728256Seric 117367736Seric errno = 0; 117467614Seric if (opt == ' ') 117567614Seric { 117667614Seric /* full word options */ 117767736Seric struct optioninfo *sel; 117867614Seric 117967614Seric p = strchr(val, '='); 118067614Seric if (p == NULL) 118167614Seric p = &val[strlen(val)]; 118267614Seric while (*--p == ' ') 118367614Seric continue; 118467614Seric while (*++p == ' ') 118567614Seric *p = '\0'; 118667731Seric if (p == val) 118767731Seric { 118867731Seric syserr("readcf: null option name"); 118967731Seric return; 119067731Seric } 119167614Seric if (*p == '=') 119267614Seric *p++ = '\0'; 119367614Seric while (*p == ' ') 119467614Seric p++; 119567736Seric sel = NULL; 119667614Seric for (o = OptionTab; o->o_name != NULL; o++) 119767614Seric { 119867736Seric if (strncasecmp(o->o_name, val, strlen(val)) != 0) 119967736Seric continue; 120067736Seric if (strlen(o->o_name) == strlen(val)) 120167736Seric { 120267736Seric /* completely specified -- this must be it */ 120367736Seric sel = NULL; 120467614Seric break; 120567736Seric } 120667736Seric if (sel != NULL) 120767736Seric break; 120867736Seric sel = o; 120967614Seric } 121067736Seric if (sel != NULL && o->o_name == NULL) 121167736Seric o = sel; 121267736Seric else if (o->o_name == NULL) 121367787Seric { 121467614Seric syserr("readcf: unknown option name %s", val); 121567787Seric return; 121667787Seric } 121767736Seric else if (sel != NULL) 121867736Seric { 121967736Seric syserr("readcf: ambiguous option name %s (matches %s and %s)", 122067736Seric val, sel->o_name, o->o_name); 122167736Seric return; 122267736Seric } 122367736Seric if (strlen(val) != strlen(o->o_name)) 122467736Seric { 122567736Seric bool oldVerbose = Verbose; 122667736Seric 122767736Seric Verbose = TRUE; 122867736Seric message("Option %s used as abbreviation for %s", 122967736Seric val, o->o_name); 123067736Seric Verbose = oldVerbose; 123167736Seric } 123267614Seric opt = o->o_code; 123367614Seric val = p; 123467614Seric } 123567614Seric else 123667614Seric { 123767614Seric for (o = OptionTab; o->o_name != NULL; o++) 123867614Seric { 123967614Seric if (o->o_code == opt) 124067614Seric break; 124167614Seric } 124267614Seric } 124367614Seric 12448256Seric if (tTd(37, 1)) 124567731Seric { 124667731Seric printf(isascii(opt) && isprint(opt) ? 124767731Seric "setoption %s (%c)=%s" : "setoption %s (0x%x)=%s", 124867614Seric o->o_name == NULL ? "<unknown>" : o->o_name, 124967614Seric opt, val); 125067731Seric } 12518256Seric 12528256Seric /* 12538269Seric ** See if this option is preset for us. 12548256Seric */ 12558256Seric 125659731Seric if (!sticky && bitnset(opt, StickyOpt)) 12578269Seric { 12589341Seric if (tTd(37, 1)) 12599341Seric printf(" (ignored)\n"); 12608269Seric return; 12618269Seric } 12628269Seric 126321755Seric /* 126421755Seric ** Check to see if this option can be specified by this user. 126521755Seric */ 126621755Seric 126763787Seric if (!safe && RealUid == 0) 126821755Seric safe = TRUE; 126967614Seric if (!safe && !o->o_safe) 127021755Seric { 127139111Srick if (opt != 'M' || (val[0] != 'r' && val[0] != 's')) 127221755Seric { 127336582Sbostic if (tTd(37, 1)) 127436582Sbostic printf(" (unsafe)"); 127563787Seric if (RealUid != geteuid()) 127636582Sbostic { 127751210Seric if (tTd(37, 1)) 127851210Seric printf("(Resetting uid)"); 127963787Seric (void) setgid(RealGid); 128063787Seric (void) setuid(RealUid); 128136582Sbostic } 128221755Seric } 128321755Seric } 128451210Seric if (tTd(37, 1)) 128517985Seric printf("\n"); 12868269Seric 128767614Seric switch (opt & 0xff) 12888256Seric { 128959709Seric case '7': /* force seven-bit input */ 129067546Seric SevenBitInput = atobool(val); 129152106Seric break; 129252106Seric 129367546Seric case '8': /* handling of 8-bit input */ 129467546Seric switch (*val) 129567546Seric { 129667547Seric case 'r': /* reject 8-bit, don't convert MIME */ 129767546Seric MimeMode = 0; 129867546Seric break; 129967546Seric 130067547Seric case 'm': /* convert 8-bit, convert MIME */ 130167546Seric MimeMode = MM_CVTMIME|MM_MIME8BIT; 130267546Seric break; 130367546Seric 130467547Seric case 'j': /* "just send 8" */ 130567546Seric MimeMode = MM_PASS8BIT; 130667546Seric break; 130767546Seric 130867546Seric case 'p': /* pass 8 bit, convert MIME */ 130967546Seric MimeMode = MM_PASS8BIT|MM_CVTMIME; 131067546Seric break; 131167546Seric 131267546Seric case 's': /* strict adherence */ 131367546Seric MimeMode = MM_CVTMIME; 131467546Seric break; 131567546Seric 131667547Seric case 'a': /* encode 8 bit if available */ 131767546Seric MimeMode = MM_MIME8BIT|MM_PASS8BIT|MM_CVTMIME; 131867546Seric break; 131967546Seric 132067547Seric case 'c': /* convert 8 bit to MIME, never 7 bit */ 132167547Seric MimeMode = MM_MIME8BIT; 132267547Seric break; 132367547Seric 132467546Seric default: 132567546Seric syserr("Unknown 8-bit mode %c", *val); 132667546Seric exit(EX_USAGE); 132767546Seric } 132867546Seric break; 132967546Seric 13308256Seric case 'A': /* set default alias file */ 13319381Seric if (val[0] == '\0') 133259672Seric setalias("aliases"); 13339381Seric else 133459672Seric setalias(val); 13358256Seric break; 13368256Seric 133717474Seric case 'a': /* look N minutes for "@:@" in alias file */ 133817474Seric if (val[0] == '\0') 133964796Seric SafeAlias = 5 * 60; /* five minutes */ 134017474Seric else 134164796Seric SafeAlias = convtime(val, 'm'); 134217474Seric break; 134317474Seric 134416843Seric case 'B': /* substitution for blank character */ 134516843Seric SpaceSub = val[0]; 134616843Seric if (SpaceSub == '\0') 134716843Seric SpaceSub = ' '; 134816843Seric break; 134916843Seric 135059283Seric case 'b': /* min blocks free on queue fs/max msg size */ 135159283Seric p = strchr(val, '/'); 135259283Seric if (p != NULL) 135359283Seric { 135459283Seric *p++ = '\0'; 135559283Seric MaxMessageSize = atol(p); 135659283Seric } 135758082Seric MinBlocksFree = atol(val); 135858082Seric break; 135958082Seric 13609284Seric case 'c': /* don't connect to "expensive" mailers */ 13619381Seric NoConnect = atobool(val); 13629284Seric break; 13639284Seric 136451305Seric case 'C': /* checkpoint every N addresses */ 136551305Seric CheckpointInterval = atoi(val); 136624944Seric break; 136724944Seric 13689284Seric case 'd': /* delivery mode */ 13699284Seric switch (*val) 13708269Seric { 13719284Seric case '\0': 137258734Seric e->e_sendmode = SM_DELIVER; 13738269Seric break; 13748269Seric 137510755Seric case SM_QUEUE: /* queue only */ 137610755Seric #ifndef QUEUE 137710755Seric syserr("need QUEUE to set -odqueue"); 137856795Seric #endif /* QUEUE */ 137910755Seric /* fall through..... */ 138010755Seric 13819284Seric case SM_DELIVER: /* do everything */ 13829284Seric case SM_FORK: /* fork after verification */ 138358734Seric e->e_sendmode = *val; 13848269Seric break; 13858269Seric 13868269Seric default: 13879284Seric syserr("Unknown delivery mode %c", *val); 13888269Seric exit(EX_USAGE); 13898269Seric } 13908269Seric break; 13918269Seric 13929146Seric case 'D': /* rebuild alias database as needed */ 13939381Seric AutoRebuild = atobool(val); 13949146Seric break; 13959146Seric 139655372Seric case 'E': /* error message header/header file */ 139755379Seric if (*val != '\0') 139855379Seric ErrMsgFile = newstr(val); 139955372Seric break; 140055372Seric 14018269Seric case 'e': /* set error processing mode */ 14028269Seric switch (*val) 14038269Seric { 14049381Seric case EM_QUIET: /* be silent about it */ 14059381Seric case EM_MAIL: /* mail back */ 14069381Seric case EM_BERKNET: /* do berknet error processing */ 14079381Seric case EM_WRITE: /* write back (or mail) */ 14089381Seric case EM_PRINT: /* print errors normally (default) */ 140958734Seric e->e_errormode = *val; 14108269Seric break; 14118269Seric } 14128269Seric break; 14138269Seric 14149049Seric case 'F': /* file mode */ 141517975Seric FileMode = atooct(val) & 0777; 14169049Seric break; 14179049Seric 14188269Seric case 'f': /* save Unix-style From lines on front */ 14199381Seric SaveFrom = atobool(val); 14208269Seric break; 14218269Seric 142253735Seric case 'G': /* match recipients against GECOS field */ 142353735Seric MatchGecos = atobool(val); 142453735Seric break; 142553735Seric 14268256Seric case 'g': /* default gid */ 142767823Seric g_opt: 142864133Seric if (isascii(*val) && isdigit(*val)) 142964133Seric DefGid = atoi(val); 143064133Seric else 143164133Seric { 143264133Seric register struct group *gr; 143364133Seric 143464133Seric DefGid = -1; 143564133Seric gr = getgrnam(val); 143664133Seric if (gr == NULL) 143767823Seric syserr("readcf: option %c: unknown group %s", 143867823Seric opt, val); 143964133Seric else 144064133Seric DefGid = gr->gr_gid; 144164133Seric } 14428256Seric break; 14438256Seric 14448256Seric case 'H': /* help file */ 14459381Seric if (val[0] == '\0') 14468269Seric HelpFile = "sendmail.hf"; 14479381Seric else 14489381Seric HelpFile = newstr(val); 14498256Seric break; 14508256Seric 145151305Seric case 'h': /* maximum hop count */ 145251305Seric MaxHopCount = atoi(val); 145351305Seric break; 145451305Seric 145535651Seric case 'I': /* use internet domain name server */ 145666334Seric #if NAMED_BIND 145757207Seric UseNameServer = TRUE; 145857207Seric for (p = val; *p != 0; ) 145957207Seric { 146057207Seric bool clearmode; 146157207Seric char *q; 146257207Seric struct resolverflags *rfp; 146357207Seric 146457207Seric while (*p == ' ') 146557207Seric p++; 146657207Seric if (*p == '\0') 146757207Seric break; 146857207Seric clearmode = FALSE; 146957207Seric if (*p == '-') 147057207Seric clearmode = TRUE; 147157207Seric else if (*p != '+') 147257207Seric p--; 147357207Seric p++; 147457207Seric q = p; 147558050Seric while (*p != '\0' && !(isascii(*p) && isspace(*p))) 147657207Seric p++; 147757207Seric if (*p != '\0') 147857207Seric *p++ = '\0'; 147957207Seric for (rfp = ResolverFlags; rfp->rf_name != NULL; rfp++) 148057207Seric { 148157207Seric if (strcasecmp(q, rfp->rf_name) == 0) 148257207Seric break; 148357207Seric } 148464923Seric if (rfp->rf_name == NULL) 148564923Seric syserr("readcf: I option value %s unrecognized", q); 148664923Seric else if (clearmode) 148757207Seric _res.options &= ~rfp->rf_bits; 148857207Seric else 148957207Seric _res.options |= rfp->rf_bits; 149057207Seric } 149157207Seric if (tTd(8, 2)) 149257207Seric printf("_res.options = %x\n", _res.options); 149357207Seric #else 149457207Seric usrerr("name server (I option) specified but BIND not compiled in"); 149557207Seric #endif 149635651Seric break; 149735651Seric 14988269Seric case 'i': /* ignore dot lines in message */ 14999381Seric IgnrDot = atobool(val); 15008269Seric break; 15018269Seric 150259730Seric case 'j': /* send errors in MIME (RFC 1341) format */ 150359730Seric SendMIMEErrors = atobool(val); 150459730Seric break; 150559730Seric 150657136Seric case 'J': /* .forward search path */ 150757136Seric ForwardPath = newstr(val); 150857136Seric break; 150957136Seric 151054967Seric case 'k': /* connection cache size */ 151154967Seric MaxMciCache = atoi(val); 151256215Seric if (MaxMciCache < 0) 151356215Seric MaxMciCache = 0; 151454967Seric break; 151554967Seric 151654967Seric case 'K': /* connection cache timeout */ 151758796Seric MciCacheTimeout = convtime(val, 'm'); 151854967Seric break; 151954967Seric 152061104Seric case 'l': /* use Errors-To: header */ 152161104Seric UseErrorsTo = atobool(val); 152261104Seric break; 152361104Seric 15248256Seric case 'L': /* log level */ 152564140Seric if (safe || LogLevel < atoi(val)) 152664140Seric LogLevel = atoi(val); 15278256Seric break; 15288256Seric 15298269Seric case 'M': /* define macro */ 15309381Seric define(val[0], newstr(&val[1]), CurEnv); 153116878Seric sticky = FALSE; 15328269Seric break; 15338269Seric 15348269Seric case 'm': /* send to me too */ 15359381Seric MeToo = atobool(val); 15368269Seric break; 15378269Seric 153825820Seric case 'n': /* validate RHS in newaliases */ 153925820Seric CheckAliases = atobool(val); 154025820Seric break; 154125820Seric 154261104Seric /* 'N' available -- was "net name" */ 154361104Seric 154458851Seric case 'O': /* daemon options */ 154558851Seric setdaemonoptions(val); 154658851Seric break; 154758851Seric 15488269Seric case 'o': /* assume old style headers */ 15499381Seric if (atobool(val)) 15509341Seric CurEnv->e_flags |= EF_OLDSTYLE; 15519341Seric else 15529341Seric CurEnv->e_flags &= ~EF_OLDSTYLE; 15538269Seric break; 15548269Seric 155558082Seric case 'p': /* select privacy level */ 155658082Seric p = val; 155758082Seric for (;;) 155858082Seric { 155958082Seric register struct prival *pv; 156058082Seric extern struct prival PrivacyValues[]; 156158082Seric 156258082Seric while (isascii(*p) && (isspace(*p) || ispunct(*p))) 156358082Seric p++; 156458082Seric if (*p == '\0') 156558082Seric break; 156658082Seric val = p; 156758082Seric while (isascii(*p) && isalnum(*p)) 156858082Seric p++; 156958082Seric if (*p != '\0') 157058082Seric *p++ = '\0'; 157158082Seric 157258082Seric for (pv = PrivacyValues; pv->pv_name != NULL; pv++) 157358082Seric { 157458082Seric if (strcasecmp(val, pv->pv_name) == 0) 157558082Seric break; 157658082Seric } 157758886Seric if (pv->pv_name == NULL) 157858886Seric syserr("readcf: Op line: %s unrecognized", val); 157958082Seric PrivacyFlags |= pv->pv_flag; 158058082Seric } 158158082Seric break; 158258082Seric 158324944Seric case 'P': /* postmaster copy address for returned mail */ 158424944Seric PostMasterCopy = newstr(val); 158524944Seric break; 158624944Seric 158724944Seric case 'q': /* slope of queue only function */ 158824944Seric QueueFactor = atoi(val); 158924944Seric break; 159024944Seric 15918256Seric case 'Q': /* queue directory */ 15929381Seric if (val[0] == '\0') 15938269Seric QueueDir = "mqueue"; 15949381Seric else 15959381Seric QueueDir = newstr(val); 159658789Seric if (RealUid != 0 && !safe) 159764718Seric Warn_Q_option = TRUE; 15988256Seric break; 15998256Seric 160058148Seric case 'R': /* don't prune routes */ 160158148Seric DontPruneRoutes = atobool(val); 160258148Seric break; 160358148Seric 16048256Seric case 'r': /* read timeout */ 160558112Seric settimeouts(val); 16068256Seric break; 16078256Seric 16088256Seric case 'S': /* status file */ 16099381Seric if (val[0] == '\0') 16108269Seric StatFile = "sendmail.st"; 16119381Seric else 16129381Seric StatFile = newstr(val); 16138256Seric break; 16148256Seric 16158265Seric case 's': /* be super safe, even if expensive */ 16169381Seric SuperSafe = atobool(val); 16178256Seric break; 16188256Seric 16198256Seric case 'T': /* queue timeout */ 162058737Seric p = strchr(val, '/'); 162158737Seric if (p != NULL) 162258737Seric { 162358737Seric *p++ = '\0'; 162467730Seric TimeOuts.to_q_warning[TOC_NORMAL] = convtime(p, 'd'); 162558737Seric } 162667730Seric TimeOuts.to_q_return[TOC_NORMAL] = convtime(val, 'h'); 162754967Seric break; 16288256Seric 16298265Seric case 't': /* time zone name */ 163052106Seric TimeZoneSpec = newstr(val); 16318265Seric break; 16328265Seric 163350556Seric case 'U': /* location of user database */ 163451360Seric UdbSpec = newstr(val); 163550556Seric break; 163650556Seric 16378256Seric case 'u': /* set default uid */ 163867823Seric for (p = val; *p != '\0'; p++) 163967823Seric { 164067823Seric if (*p == '.' || *p == '/' || *p == ':') 164167823Seric { 164267823Seric *p++ = '\0'; 164367823Seric break; 164467823Seric } 164567823Seric } 164664133Seric if (isascii(*val) && isdigit(*val)) 164764133Seric DefUid = atoi(val); 164864133Seric else 164964133Seric { 165064133Seric register struct passwd *pw; 165164133Seric 165264133Seric DefUid = -1; 165364133Seric pw = getpwnam(val); 165464133Seric if (pw == NULL) 165564133Seric syserr("readcf: option u: unknown user %s", val); 165664133Seric else 165767823Seric { 165864133Seric DefUid = pw->pw_uid; 165967823Seric DefGid = pw->pw_gid; 166067823Seric } 166164133Seric } 166240973Sbostic setdefuser(); 16638256Seric 166467823Seric /* handle the group if it is there */ 166567823Seric if (*p == '\0') 166667823Seric break; 166767823Seric val = p; 166867823Seric goto g_opt; 166967823Seric 167058851Seric case 'V': /* fallback MX host */ 167158851Seric FallBackMX = newstr(val); 167258851Seric break; 167358851Seric 16748269Seric case 'v': /* run in verbose mode */ 16759381Seric Verbose = atobool(val); 16768256Seric break; 16778256Seric 167863837Seric case 'w': /* if we are best MX, try host directly */ 167963837Seric TryNullMXList = atobool(val); 168063837Seric break; 168161104Seric 168261104Seric /* 'W' available -- was wizard password */ 168361104Seric 168414879Seric case 'x': /* load avg at which to auto-queue msgs */ 168514879Seric QueueLA = atoi(val); 168614879Seric break; 168714879Seric 168814879Seric case 'X': /* load avg at which to auto-reject connections */ 168914879Seric RefuseLA = atoi(val); 169014879Seric break; 169114879Seric 169224981Seric case 'y': /* work recipient factor */ 169324981Seric WkRecipFact = atoi(val); 169424981Seric break; 169524981Seric 169624981Seric case 'Y': /* fork jobs during queue runs */ 169724952Seric ForkQueueRuns = atobool(val); 169824952Seric break; 169924952Seric 170024981Seric case 'z': /* work message class factor */ 170124981Seric WkClassFact = atoi(val); 170224981Seric break; 170324981Seric 170424981Seric case 'Z': /* work time factor */ 170524981Seric WkTimeFact = atoi(val); 170624981Seric break; 170724981Seric 170867614Seric case O_BSP: /* SMTP Peers can't handle 2-line greeting */ 170967614Seric BrokenSmtpPeers = atobool(val); 171067614Seric break; 171167614Seric 171267614Seric case O_SQBH: /* sort work queue by host first */ 171367614Seric SortQueueByHost = atobool(val); 171467614Seric break; 171567614Seric 171667707Seric case O_DNICE: /* delivery nice value */ 171767707Seric DeliveryNiceness = atoi(val); 171867707Seric break; 171967707Seric 172067707Seric case O_MQA: /* minimum queue age between deliveries */ 172167707Seric MinQueueAge = convtime(val, 'm'); 172267707Seric break; 172367707Seric 172467707Seric case O_MHSA: /* maximum age of cached host status */ 172567707Seric MaxHostStatAge = convtime(val, 'm'); 172667707Seric break; 172767707Seric 172867813Seric case O_DEFCHARSET: /* default character set for mimefying */ 172967814Seric DefaultCharSet = newstr(val); 173067813Seric break; 173167813Seric 173267848Seric case O_SSFILE: /* service switch file */ 173367848Seric ServiceSwitchFile = newstr(val); 173467848Seric break; 173567848Seric 17368256Seric default: 17378256Seric break; 17388256Seric } 173916878Seric if (sticky) 174016878Seric setbitn(opt, StickyOpt); 17419188Seric return; 17428256Seric } 174310687Seric /* 174410687Seric ** SETCLASS -- set a word into a class 174510687Seric ** 174610687Seric ** Parameters: 174710687Seric ** class -- the class to put the word in. 174810687Seric ** word -- the word to enter 174910687Seric ** 175010687Seric ** Returns: 175110687Seric ** none. 175210687Seric ** 175310687Seric ** Side Effects: 175410687Seric ** puts the word into the symbol table. 175510687Seric */ 175610687Seric 175710687Seric setclass(class, word) 175810687Seric int class; 175910687Seric char *word; 176010687Seric { 176110687Seric register STAB *s; 176210687Seric 176357943Seric if (tTd(37, 8)) 176464326Seric printf("setclass(%c, %s)\n", class, word); 176510687Seric s = stab(word, ST_CLASS, ST_ENTER); 176610687Seric setbitn(class, s->s_class); 176710687Seric } 176853654Seric /* 176953654Seric ** MAKEMAPENTRY -- create a map entry 177053654Seric ** 177153654Seric ** Parameters: 177253654Seric ** line -- the config file line 177353654Seric ** 177453654Seric ** Returns: 177553654Seric ** TRUE if it successfully entered the map entry. 177653654Seric ** FALSE otherwise (usually syntax error). 177753654Seric ** 177853654Seric ** Side Effects: 177953654Seric ** Enters the map into the dictionary. 178053654Seric */ 178153654Seric 178253654Seric void 178353654Seric makemapentry(line) 178453654Seric char *line; 178553654Seric { 178653654Seric register char *p; 178753654Seric char *mapname; 178853654Seric char *classname; 178964078Seric register STAB *s; 179053654Seric STAB *class; 179153654Seric 179258050Seric for (p = line; isascii(*p) && isspace(*p); p++) 179353654Seric continue; 179458050Seric if (!(isascii(*p) && isalnum(*p))) 179553654Seric { 179653654Seric syserr("readcf: config K line: no map name"); 179753654Seric return; 179853654Seric } 179953654Seric 180053654Seric mapname = p; 180167848Seric while ((isascii(*++p) && isalnum(*p)) || *p == '.') 180253654Seric continue; 180353654Seric if (*p != '\0') 180453654Seric *p++ = '\0'; 180558050Seric while (isascii(*p) && isspace(*p)) 180653654Seric p++; 180758050Seric if (!(isascii(*p) && isalnum(*p))) 180853654Seric { 180953654Seric syserr("readcf: config K line, map %s: no map class", mapname); 181053654Seric return; 181153654Seric } 181253654Seric classname = p; 181358050Seric while (isascii(*++p) && isalnum(*p)) 181453654Seric continue; 181553654Seric if (*p != '\0') 181653654Seric *p++ = '\0'; 181758050Seric while (isascii(*p) && isspace(*p)) 181853654Seric p++; 181953654Seric 182053654Seric /* look up the class */ 182153654Seric class = stab(classname, ST_MAPCLASS, ST_FIND); 182253654Seric if (class == NULL) 182353654Seric { 182453654Seric syserr("readcf: map %s: class %s not available", mapname, classname); 182553654Seric return; 182653654Seric } 182753654Seric 182853654Seric /* enter the map */ 182964078Seric s = stab(mapname, ST_MAP, ST_ENTER); 183064078Seric s->s_map.map_class = &class->s_mapclass; 183164078Seric s->s_map.map_mname = newstr(mapname); 183253654Seric 183364078Seric if (class->s_mapclass.map_parse(&s->s_map, p)) 183464078Seric s->s_map.map_mflags |= MF_VALID; 183564078Seric 183664078Seric if (tTd(37, 5)) 183764078Seric { 183864078Seric printf("map %s, class %s, flags %x, file %s,\n", 183964078Seric s->s_map.map_mname, s->s_map.map_class->map_cname, 184064078Seric s->s_map.map_mflags, 184164078Seric s->s_map.map_file == NULL ? "(null)" : s->s_map.map_file); 184264078Seric printf("\tapp %s, domain %s, rebuild %s\n", 184364078Seric s->s_map.map_app == NULL ? "(null)" : s->s_map.map_app, 184464078Seric s->s_map.map_domain == NULL ? "(null)" : s->s_map.map_domain, 184564078Seric s->s_map.map_rebuild == NULL ? "(null)" : s->s_map.map_rebuild); 184664078Seric } 184753654Seric } 184858112Seric /* 184958112Seric ** SETTIMEOUTS -- parse and set timeout values 185058112Seric ** 185158112Seric ** Parameters: 185258112Seric ** val -- a pointer to the values. If NULL, do initial 185358112Seric ** settings. 185458112Seric ** 185558112Seric ** Returns: 185658112Seric ** none. 185758112Seric ** 185858112Seric ** Side Effects: 185958112Seric ** Initializes the TimeOuts structure 186058112Seric */ 186158112Seric 186264255Seric #define SECONDS 186358112Seric #define MINUTES * 60 186458112Seric #define HOUR * 3600 186558112Seric 186658112Seric settimeouts(val) 186758112Seric register char *val; 186858112Seric { 186958112Seric register char *p; 187058671Seric extern time_t convtime(); 187158112Seric 187258112Seric if (val == NULL) 187358112Seric { 187458112Seric TimeOuts.to_initial = (time_t) 5 MINUTES; 187558112Seric TimeOuts.to_helo = (time_t) 5 MINUTES; 187658112Seric TimeOuts.to_mail = (time_t) 10 MINUTES; 187758112Seric TimeOuts.to_rcpt = (time_t) 1 HOUR; 187858112Seric TimeOuts.to_datainit = (time_t) 5 MINUTES; 187958112Seric TimeOuts.to_datablock = (time_t) 1 HOUR; 188058112Seric TimeOuts.to_datafinal = (time_t) 1 HOUR; 188158112Seric TimeOuts.to_rset = (time_t) 5 MINUTES; 188258112Seric TimeOuts.to_quit = (time_t) 2 MINUTES; 188358112Seric TimeOuts.to_nextcommand = (time_t) 1 HOUR; 188458112Seric TimeOuts.to_miscshort = (time_t) 2 MINUTES; 188564255Seric TimeOuts.to_ident = (time_t) 30 SECONDS; 188667711Seric TimeOuts.to_fileopen = (time_t) 60 SECONDS; 188758112Seric return; 188858112Seric } 188958112Seric 189058112Seric for (;; val = p) 189158112Seric { 189258112Seric while (isascii(*val) && isspace(*val)) 189358112Seric val++; 189458112Seric if (*val == '\0') 189558112Seric break; 189658112Seric for (p = val; *p != '\0' && *p != ','; p++) 189758112Seric continue; 189858112Seric if (*p != '\0') 189958112Seric *p++ = '\0'; 190058112Seric 190158112Seric if (isascii(*val) && isdigit(*val)) 190258112Seric { 190358112Seric /* old syntax -- set everything */ 190458796Seric TimeOuts.to_mail = convtime(val, 'm'); 190558112Seric TimeOuts.to_rcpt = TimeOuts.to_mail; 190658112Seric TimeOuts.to_datainit = TimeOuts.to_mail; 190758112Seric TimeOuts.to_datablock = TimeOuts.to_mail; 190858112Seric TimeOuts.to_datafinal = TimeOuts.to_mail; 190958112Seric TimeOuts.to_nextcommand = TimeOuts.to_mail; 191058112Seric continue; 191158112Seric } 191258112Seric else 191358112Seric { 191467711Seric register char *q = strchr(val, ':'); 191558112Seric time_t to; 191658112Seric 191767711Seric if (q == NULL && (q = strchr(val, '=')) == NULL) 191858112Seric { 191958112Seric /* syntax error */ 192058112Seric continue; 192158112Seric } 192258112Seric *q++ = '\0'; 192358796Seric to = convtime(q, 'm'); 192458112Seric 192558112Seric if (strcasecmp(val, "initial") == 0) 192658112Seric TimeOuts.to_initial = to; 192758112Seric else if (strcasecmp(val, "mail") == 0) 192858112Seric TimeOuts.to_mail = to; 192958112Seric else if (strcasecmp(val, "rcpt") == 0) 193058112Seric TimeOuts.to_rcpt = to; 193158112Seric else if (strcasecmp(val, "datainit") == 0) 193258112Seric TimeOuts.to_datainit = to; 193358112Seric else if (strcasecmp(val, "datablock") == 0) 193458112Seric TimeOuts.to_datablock = to; 193558112Seric else if (strcasecmp(val, "datafinal") == 0) 193658112Seric TimeOuts.to_datafinal = to; 193758112Seric else if (strcasecmp(val, "command") == 0) 193858112Seric TimeOuts.to_nextcommand = to; 193958112Seric else if (strcasecmp(val, "rset") == 0) 194058112Seric TimeOuts.to_rset = to; 194158112Seric else if (strcasecmp(val, "helo") == 0) 194258112Seric TimeOuts.to_helo = to; 194358112Seric else if (strcasecmp(val, "quit") == 0) 194458112Seric TimeOuts.to_quit = to; 194558112Seric else if (strcasecmp(val, "misc") == 0) 194658112Seric TimeOuts.to_miscshort = to; 194764255Seric else if (strcasecmp(val, "ident") == 0) 194864255Seric TimeOuts.to_ident = to; 194967711Seric else if (strcasecmp(val, "fileopen") == 0) 195067711Seric TimeOuts.to_fileopen = to; 195167711Seric else if (strcasecmp(val, "queuewarn") == 0) 195267730Seric TimeOuts.to_q_warning[TOC_NORMAL] = to; 195367711Seric else if (strcasecmp(val, "queuereturn") == 0) 195467730Seric TimeOuts.to_q_return[TOC_NORMAL] = to; 195567730Seric else if (strcasecmp(val, "queuewarn.normal") == 0) 195667730Seric TimeOuts.to_q_warning[TOC_NORMAL] = to; 195767730Seric else if (strcasecmp(val, "queuereturn.normal") == 0) 195867730Seric TimeOuts.to_q_return[TOC_NORMAL] = to; 195967730Seric else if (strcasecmp(val, "queuewarn.urgent") == 0) 196067730Seric TimeOuts.to_q_warning[TOC_URGENT] = to; 196167730Seric else if (strcasecmp(val, "queuereturn.urgent") == 0) 196267730Seric TimeOuts.to_q_return[TOC_URGENT] = to; 196367730Seric else if (strcasecmp(val, "queuewarn.non-urgent") == 0) 196467730Seric TimeOuts.to_q_warning[TOC_NONURGENT] = to; 196567730Seric else if (strcasecmp(val, "queuereturn.non-urgent") == 0) 196667730Seric TimeOuts.to_q_return[TOC_NONURGENT] = to; 196758112Seric else 196858112Seric syserr("settimeouts: invalid timeout %s", val); 196958112Seric } 197058112Seric } 197158112Seric } 1972