13313Seric # include "sendmail.h" 23308Seric 3*10709Seric SCCSID(@(#)readcf.c 3.55 02/03/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(); 63*10709Seric 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 */ 136*10709Seric 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 register STAB *s; 1694061Seric 1704061Seric while (*p != '\0' && isspace(*p)) 1714061Seric p++; 1724061Seric wd = p; 1734061Seric while (*p != '\0' && !isspace(*p)) 1744061Seric p++; 1754061Seric delim = *p; 1764061Seric *p = '\0'; 1774061Seric if (wd[0] != '\0') 17810687Seric setclass(buf[1], wd); 1794061Seric *p = delim; 1804061Seric } 1814061Seric break; 1824061Seric 1834096Seric case 'M': /* define mailer */ 1844217Seric makemailer(&buf[1], safe); 1854096Seric break; 1864096Seric 1878252Seric case 'O': /* set option */ 1888269Seric setoption(buf[1], &buf[2], safe, FALSE); 1898252Seric break; 1908252Seric 1918252Seric case 'P': /* set precedence */ 1928252Seric if (NumPriorities >= MAXPRIORITIES) 1938252Seric { 1948547Seric toomany('P', MAXPRIORITIES); 1958252Seric break; 1968252Seric } 1979381Seric for (p = &buf[1]; *p != '\0' && *p != '=' && *p != '\t'; p++) 1988252Seric continue; 1998252Seric if (*p == '\0') 2008252Seric goto badline; 2018252Seric *p = '\0'; 2028252Seric Priorities[NumPriorities].pri_name = newstr(&buf[1]); 2038252Seric Priorities[NumPriorities].pri_val = atoi(++p); 2048252Seric NumPriorities++; 2058252Seric break; 2068252Seric 2078547Seric case 'T': /* trusted user(s) */ 2088547Seric p = &buf[1]; 2098547Seric while (*p != '\0') 2108547Seric { 2118547Seric while (isspace(*p)) 2128547Seric p++; 2138547Seric q = p; 2148547Seric while (*p != '\0' && !isspace(*p)) 2158547Seric p++; 2168547Seric if (*p != '\0') 2178547Seric *p++ = '\0'; 2188547Seric if (*q == '\0') 2198547Seric continue; 2208547Seric for (pv = TrustedUsers; *pv != NULL; pv++) 2218547Seric continue; 2228547Seric if (pv >= &TrustedUsers[MAXTRUST]) 2238547Seric { 2248547Seric toomany('T', MAXTRUST); 2258547Seric break; 2268547Seric } 2278547Seric *pv = newstr(q); 2288547Seric } 2298547Seric break; 2308547Seric 2313308Seric default: 2324061Seric badline: 2339381Seric syserr("unknown control line \"%s\"", buf); 2343308Seric } 2353308Seric } 2369381Seric FileName = NULL; 2374096Seric } 2384096Seric /* 2398547Seric ** TOOMANY -- signal too many of some option 2408547Seric ** 2418547Seric ** Parameters: 2428547Seric ** id -- the id of the error line 2438547Seric ** maxcnt -- the maximum possible values 2448547Seric ** 2458547Seric ** Returns: 2468547Seric ** none. 2478547Seric ** 2488547Seric ** Side Effects: 2498547Seric ** gives a syserr. 2508547Seric */ 2518547Seric 2528547Seric toomany(id, maxcnt) 2538547Seric char id; 2548547Seric int maxcnt; 2558547Seric { 2569381Seric syserr("too many %c lines, %d max", id, maxcnt); 2578547Seric } 2588547Seric /* 2594432Seric ** FILECLASS -- read members of a class from a file 2604432Seric ** 2614432Seric ** Parameters: 2624432Seric ** class -- class to define. 2634432Seric ** filename -- name of file to read. 2644432Seric ** fmt -- scanf string to use for match. 2654432Seric ** 2664432Seric ** Returns: 2674432Seric ** none 2684432Seric ** 2694432Seric ** Side Effects: 2704432Seric ** 2714432Seric ** puts all lines in filename that match a scanf into 2724432Seric ** the named class. 2734432Seric */ 2744432Seric 2754432Seric fileclass(class, filename, fmt) 2764432Seric int class; 2774432Seric char *filename; 2784432Seric char *fmt; 2794432Seric { 2804432Seric register FILE *f; 2814432Seric char buf[MAXLINE]; 2824432Seric 2834432Seric f = fopen(filename, "r"); 2844432Seric if (f == NULL) 2854432Seric { 2864432Seric syserr("cannot open %s", filename); 2874432Seric return; 2884432Seric } 2894432Seric 2904432Seric while (fgets(buf, sizeof buf, f) != NULL) 2914432Seric { 2924432Seric register STAB *s; 2934432Seric char wordbuf[MAXNAME+1]; 2944432Seric 2954432Seric if (sscanf(buf, fmt, wordbuf) != 1) 2964432Seric continue; 2974432Seric s = stab(wordbuf, ST_CLASS, ST_ENTER); 29810687Seric setbitn(class, s->s_class); 2994432Seric } 3004432Seric 3014627Seric (void) fclose(f); 3024432Seric } 3034432Seric /* 3044096Seric ** MAKEMAILER -- define a new mailer. 3054096Seric ** 3064096Seric ** Parameters: 30710327Seric ** line -- description of mailer. This is in labeled 30810327Seric ** fields. The fields are: 30910327Seric ** P -- the path to the mailer 31010327Seric ** F -- the flags associated with the mailer 31110327Seric ** A -- the argv for this mailer 31210327Seric ** S -- the sender rewriting set 31310327Seric ** R -- the recipient rewriting set 31410327Seric ** E -- the eol string 31510327Seric ** The first word is the canonical name of the mailer. 3164217Seric ** safe -- set if this is a safe configuration file. 3174096Seric ** 3184096Seric ** Returns: 3194096Seric ** none. 3204096Seric ** 3214096Seric ** Side Effects: 3224096Seric ** enters the mailer into the mailer table. 3234096Seric */ 3243308Seric 3254217Seric makemailer(line, safe) 3264096Seric char *line; 3274217Seric bool safe; 3284096Seric { 3294096Seric register char *p; 3308067Seric register struct mailer *m; 3318067Seric register STAB *s; 3328067Seric int i; 33310327Seric char fcode; 3344096Seric extern int NextMailer; 33510327Seric extern char **makeargv(); 33610327Seric extern char *munchstring(); 33710327Seric extern char *DelimChar; 33810701Seric extern long atol(); 3394096Seric 34010327Seric /* allocate a mailer and set up defaults */ 34110327Seric m = (struct mailer *) xalloc(sizeof *m); 34210327Seric bzero((char *) m, sizeof *m); 34310327Seric m->m_mno = NextMailer; 34410327Seric m->m_eol = "\n"; 34510327Seric 34610327Seric /* collect the mailer name */ 34710327Seric for (p = line; *p != '\0' && *p != ',' && !isspace(*p); p++) 34810327Seric continue; 34910327Seric if (*p != '\0') 35010327Seric *p++ = '\0'; 35110327Seric m->m_name = newstr(line); 35210327Seric 35310327Seric /* now scan through and assign info from the fields */ 35410327Seric while (*p != '\0') 35510327Seric { 35610327Seric while (*p != '\0' && (*p == ',' || isspace(*p))) 35710327Seric p++; 35810327Seric 35910327Seric /* p now points to field code */ 36010327Seric fcode = *p; 36110327Seric while (*p != '\0' && *p != '=' && *p != ',') 36210327Seric p++; 36310327Seric if (*p++ != '=') 36410327Seric { 36510327Seric syserr("`=' expected"); 36610327Seric return; 36710327Seric } 36810327Seric while (isspace(*p)) 36910327Seric p++; 37010327Seric 37110327Seric /* p now points to the field body */ 37210327Seric p = munchstring(p); 37310327Seric 37410327Seric /* install the field into the mailer struct */ 37510327Seric switch (fcode) 37610327Seric { 37710327Seric case 'P': /* pathname */ 37810327Seric m->m_mailer = newstr(p); 37910327Seric break; 38010327Seric 38110327Seric case 'F': /* flags */ 38210687Seric for (; *p != '\0'; p++) 38310687Seric setbitn(*p, m->m_flags); 38410327Seric if (!safe) 38510687Seric clrbitn(M_RESTR, m->m_flags); 38610327Seric break; 38710327Seric 38810327Seric case 'S': /* sender rewriting ruleset */ 38910327Seric case 'R': /* recipient rewriting ruleset */ 39010327Seric i = atoi(p); 39110327Seric if (i < 0 || i >= MAXRWSETS) 39210327Seric { 39310327Seric syserr("invalid rewrite set, %d max", MAXRWSETS); 39410327Seric return; 39510327Seric } 39610327Seric if (fcode == 'S') 39710327Seric m->m_s_rwset = i; 39810327Seric else 39910327Seric m->m_r_rwset = i; 40010327Seric break; 40110327Seric 40210327Seric case 'E': /* end of line string */ 40310327Seric m->m_eol = newstr(p); 40410327Seric break; 40510327Seric 40610327Seric case 'A': /* argument vector */ 40710327Seric m->m_argv = makeargv(p); 40810327Seric break; 40910701Seric 41010701Seric case 'M': /* maximum message size */ 41110701Seric m->m_maxsize = atol(p); 41210701Seric break; 41310327Seric } 41410327Seric 41510327Seric p = DelimChar; 41610327Seric } 41710327Seric 41810327Seric /* now store the mailer away */ 4194096Seric if (NextMailer >= MAXMAILERS) 4204096Seric { 4219381Seric syserr("too many mailers defined (%d max)", MAXMAILERS); 4224096Seric return; 4234096Seric } 42410327Seric Mailer[NextMailer++] = m; 42510327Seric s = stab(m->m_name, ST_MAILER, ST_ENTER); 42610327Seric s->s_mailer = m; 42710327Seric } 42810327Seric /* 42910327Seric ** MUNCHSTRING -- translate a string into internal form. 43010327Seric ** 43110327Seric ** Parameters: 43210327Seric ** p -- the string to munch. 43310327Seric ** 43410327Seric ** Returns: 43510327Seric ** the munched string. 43610327Seric ** 43710327Seric ** Side Effects: 43810327Seric ** Sets "DelimChar" to point to the string that caused us 43910327Seric ** to stop. 44010327Seric */ 4414096Seric 44210327Seric char * 44310327Seric munchstring(p) 44410327Seric register char *p; 44510327Seric { 44610327Seric register char *q; 44710327Seric bool backslash = FALSE; 44810327Seric bool quotemode = FALSE; 44910327Seric static char buf[MAXLINE]; 45010327Seric extern char *DelimChar; 4514096Seric 45210327Seric for (q = buf; *p != '\0'; p++) 4534096Seric { 45410327Seric if (backslash) 45510327Seric { 45610327Seric /* everything is roughly literal */ 45710357Seric backslash = FALSE; 45810327Seric switch (*p) 45910327Seric { 46010327Seric case 'r': /* carriage return */ 46110327Seric *q++ = '\r'; 46210327Seric continue; 46310327Seric 46410327Seric case 'n': /* newline */ 46510327Seric *q++ = '\n'; 46610327Seric continue; 46710327Seric 46810327Seric case 'f': /* form feed */ 46910327Seric *q++ = '\f'; 47010327Seric continue; 47110327Seric 47210327Seric case 'b': /* backspace */ 47310327Seric *q++ = '\b'; 47410327Seric continue; 47510327Seric } 47610327Seric *q++ = *p; 47710327Seric } 47810327Seric else 47910327Seric { 48010327Seric if (*p == '\\') 48110327Seric backslash = TRUE; 48210327Seric else if (*p == '"') 48310327Seric quotemode = !quotemode; 48410327Seric else if (quotemode || *p != ',') 48510327Seric *q++ = *p; 48610327Seric else 48710327Seric break; 48810327Seric } 4894096Seric } 4904096Seric 49110327Seric DelimChar = p; 49210327Seric *q++ = '\0'; 49310327Seric return (buf); 49410327Seric } 49510327Seric /* 49610327Seric ** MAKEARGV -- break up a string into words 49710327Seric ** 49810327Seric ** Parameters: 49910327Seric ** p -- the string to break up. 50010327Seric ** 50110327Seric ** Returns: 50210327Seric ** a char **argv (dynamically allocated) 50310327Seric ** 50410327Seric ** Side Effects: 50510327Seric ** munges p. 50610327Seric */ 5074096Seric 50810327Seric char ** 50910327Seric makeargv(p) 51010327Seric register char *p; 51110327Seric { 51210327Seric char *q; 51310327Seric int i; 51410327Seric char **avp; 51510327Seric char *argv[MAXPV + 1]; 51610327Seric 51710327Seric /* take apart the words */ 51810327Seric i = 0; 51910327Seric while (*p != '\0' && i < MAXPV) 5204096Seric { 52110327Seric q = p; 52210327Seric while (*p != '\0' && !isspace(*p)) 52310327Seric p++; 52410327Seric while (isspace(*p)) 52510327Seric *p++ = '\0'; 52610327Seric argv[i++] = newstr(q); 5274096Seric } 52810327Seric argv[i++] = NULL; 5294096Seric 53010327Seric /* now make a copy of the argv */ 53110327Seric avp = (char **) xalloc(sizeof *avp * i); 53210327Seric bmove((char *) argv, (char *) avp, sizeof *avp * i); 53310327Seric 53410327Seric return (avp); 5353308Seric } 5363308Seric /* 5373308Seric ** PRINTRULES -- print rewrite rules (for debugging) 5383308Seric ** 5393308Seric ** Parameters: 5403308Seric ** none. 5413308Seric ** 5423308Seric ** Returns: 5433308Seric ** none. 5443308Seric ** 5453308Seric ** Side Effects: 5463308Seric ** prints rewrite rules. 5473308Seric */ 5483308Seric 5494319Seric # ifdef DEBUG 5504319Seric 5513308Seric printrules() 5523308Seric { 5533308Seric register struct rewrite *rwp; 5544072Seric register int ruleset; 5553308Seric 5564072Seric for (ruleset = 0; ruleset < 10; ruleset++) 5573308Seric { 5584072Seric if (RewriteRules[ruleset] == NULL) 5594072Seric continue; 5608067Seric printf("\n----Rule Set %d:", ruleset); 5613308Seric 5624072Seric for (rwp = RewriteRules[ruleset]; rwp != NULL; rwp = rwp->r_next) 5633308Seric { 5648067Seric printf("\nLHS:"); 5658067Seric printav(rwp->r_lhs); 5668067Seric printf("RHS:"); 5678067Seric printav(rwp->r_rhs); 5683308Seric } 5693308Seric } 5703308Seric } 5714319Seric 5724319Seric # endif DEBUG 5734096Seric /* 5748256Seric ** SETOPTION -- set global processing option 5758256Seric ** 5768256Seric ** Parameters: 5778256Seric ** opt -- option name. 5788256Seric ** val -- option value (as a text string). 5798269Seric ** safe -- if set, this came from a system configuration file. 5808269Seric ** sticky -- if set, don't let other setoptions override 5818269Seric ** this value. 5828256Seric ** 5838256Seric ** Returns: 5848256Seric ** none. 5858256Seric ** 5868256Seric ** Side Effects: 5878256Seric ** Sets options as implied by the arguments. 5888256Seric */ 5898256Seric 59010687Seric static BITMAP StickyOpt; /* set if option is stuck */ 59110687Seric extern char *WizWord; /* the stored wizard password */ 59210343Seric #ifdef DAEMON 59310687Seric extern int MaxConnections; /* max simult. SMTP conns */ 59410343Seric #endif DAEMON 5958269Seric 5968269Seric setoption(opt, val, safe, sticky) 5978256Seric char opt; 5988256Seric char *val; 5998269Seric bool safe; 6008269Seric bool sticky; 6018256Seric { 6028265Seric extern bool atobool(); 6038256Seric 6048256Seric # ifdef DEBUG 6058256Seric if (tTd(37, 1)) 6069341Seric printf("setoption %c=%s", opt, val); 6078256Seric # endif DEBUG 6088256Seric 6098256Seric /* 6108269Seric ** See if this option is preset for us. 6118256Seric */ 6128256Seric 61310687Seric if (bitnset(opt, StickyOpt)) 6148269Seric { 6158269Seric # ifdef DEBUG 6169341Seric if (tTd(37, 1)) 6179341Seric printf(" (ignored)\n"); 6188269Seric # endif DEBUG 6198269Seric return; 6208269Seric } 6219341Seric #ifdef DEBUG 6229341Seric else if (tTd(37, 1)) 6239341Seric printf("\n"); 6249341Seric #endif DEBUG 6258269Seric if (sticky) 62610687Seric setbitn(opt, StickyOpt); 6278269Seric 6288269Seric if (getruid() == 0) 6298269Seric safe = TRUE; 6308269Seric 6318256Seric switch (opt) 6328256Seric { 6338256Seric case 'A': /* set default alias file */ 6349381Seric if (val[0] == '\0') 6358269Seric AliasFile = "aliases"; 6369381Seric else 6379381Seric AliasFile = newstr(val); 6388256Seric break; 6398256Seric 6408931Seric case 'a': /* look for "@:@" in alias file */ 6419381Seric SafeAlias = atobool(val); 6428931Seric break; 6438931Seric 6449284Seric case 'c': /* don't connect to "expensive" mailers */ 6459381Seric NoConnect = atobool(val); 6469284Seric break; 6479284Seric 6489284Seric case 'd': /* delivery mode */ 6499284Seric switch (*val) 6508269Seric { 6519284Seric case '\0': 6529284Seric SendMode = SM_DELIVER; 6538269Seric break; 6548269Seric 6559284Seric case SM_DELIVER: /* do everything */ 6569284Seric case SM_FORK: /* fork after verification */ 6579284Seric case SM_QUEUE: /* queue only */ 6589284Seric SendMode = *val; 6598269Seric break; 6608269Seric 6618269Seric default: 6629284Seric syserr("Unknown delivery mode %c", *val); 6638269Seric exit(EX_USAGE); 6648269Seric } 6658269Seric break; 6668269Seric 6679146Seric case 'D': /* rebuild alias database as needed */ 6689381Seric AutoRebuild = atobool(val); 6699146Seric break; 6709146Seric 6718269Seric case 'e': /* set error processing mode */ 6728269Seric switch (*val) 6738269Seric { 6749381Seric case EM_QUIET: /* be silent about it */ 6758269Seric (void) freopen("/dev/null", "w", stdout); 6769381Seric /* fall through... */ 6778269Seric 6789381Seric case EM_MAIL: /* mail back */ 6799381Seric case EM_BERKNET: /* do berknet error processing */ 6809381Seric case EM_WRITE: /* write back (or mail) */ 6818269Seric HoldErrs = TRUE; 6829381Seric /* fall through... */ 6838269Seric 6849381Seric case EM_PRINT: /* print errors normally (default) */ 6859381Seric ErrorMode = *val; 6868269Seric break; 6878269Seric } 6888269Seric break; 6898269Seric 6909049Seric case 'F': /* file mode */ 6919381Seric FileMode = atooct(val); 6929049Seric break; 6939049Seric 6948269Seric case 'f': /* save Unix-style From lines on front */ 6959381Seric SaveFrom = atobool(val); 6968269Seric break; 6978269Seric 6988256Seric case 'g': /* default gid */ 6999105Seric if (safe) 7009381Seric DefGid = atoi(val); 7018256Seric break; 7028256Seric 7038256Seric case 'H': /* help file */ 7049381Seric if (val[0] == '\0') 7058269Seric HelpFile = "sendmail.hf"; 7069381Seric else 7079381Seric HelpFile = newstr(val); 7088256Seric break; 7098256Seric 7108269Seric case 'i': /* ignore dot lines in message */ 7119381Seric IgnrDot = atobool(val); 7128269Seric break; 7138269Seric 7148256Seric case 'L': /* log level */ 7159381Seric LogLevel = atoi(val); 7168256Seric break; 7178256Seric 7188269Seric case 'M': /* define macro */ 7199381Seric define(val[0], newstr(&val[1]), CurEnv); 7208269Seric break; 7218269Seric 7228269Seric case 'm': /* send to me too */ 7239381Seric MeToo = atobool(val); 7248269Seric break; 7258269Seric 72610343Seric #ifdef DAEMON 72710343Seric case 'N': /* maximum simultaneous SMTP connections */ 72810343Seric MaxConnections = atoi(val); 72910343Seric break; 73010343Seric #endif DAEMON 73110343Seric 7328269Seric case 'o': /* assume old style headers */ 7339381Seric if (atobool(val)) 7349341Seric CurEnv->e_flags |= EF_OLDSTYLE; 7359341Seric else 7369341Seric CurEnv->e_flags &= ~EF_OLDSTYLE; 7378269Seric break; 7388269Seric 7398256Seric case 'Q': /* queue directory */ 7409381Seric if (val[0] == '\0') 7418269Seric QueueDir = "mqueue"; 7429381Seric else 7439381Seric QueueDir = newstr(val); 7448256Seric break; 7458256Seric 7468256Seric case 'r': /* read timeout */ 7479381Seric ReadTimeout = convtime(val); 7488256Seric break; 7498256Seric 7508256Seric case 'S': /* status file */ 7519381Seric if (val[0] == '\0') 7528269Seric StatFile = "sendmail.st"; 7539381Seric else 7549381Seric StatFile = newstr(val); 7558256Seric break; 7568256Seric 7578265Seric case 's': /* be super safe, even if expensive */ 7589381Seric SuperSafe = atobool(val); 7598256Seric break; 7608256Seric 7618256Seric case 'T': /* queue timeout */ 7629381Seric TimeOut = convtime(val); 7638256Seric break; 7648256Seric 7658265Seric case 't': /* time zone name */ 7668265Seric # ifdef V6 7679381Seric StdTimezone = newstr(val); 7689381Seric DstTimezone = index(StdTimeZone, ','); 7698265Seric if (DstTimezone == NULL) 7709381Seric syserr("bad time zone spec"); 7719381Seric else 7729381Seric *DstTimezone++ = '\0'; 7738265Seric # endif V6 7748265Seric break; 7758265Seric 7768256Seric case 'u': /* set default uid */ 7779105Seric if (safe) 7789381Seric DefUid = atoi(val); 7798256Seric break; 7808256Seric 7818269Seric case 'v': /* run in verbose mode */ 7829381Seric Verbose = atobool(val); 7838256Seric break; 7848256Seric 7858544Seric # ifdef DEBUG 7868544Seric case 'W': /* set the wizards password */ 7879105Seric if (safe) 7889381Seric WizWord = newstr(val); 7898544Seric break; 7908544Seric # endif DEBUG 7918544Seric 7928256Seric default: 7938256Seric break; 7948256Seric } 7959188Seric return; 7968256Seric } 79710687Seric /* 79810687Seric ** SETCLASS -- set a word into a class 79910687Seric ** 80010687Seric ** Parameters: 80110687Seric ** class -- the class to put the word in. 80210687Seric ** word -- the word to enter 80310687Seric ** 80410687Seric ** Returns: 80510687Seric ** none. 80610687Seric ** 80710687Seric ** Side Effects: 80810687Seric ** puts the word into the symbol table. 80910687Seric */ 81010687Seric 81110687Seric setclass(class, word) 81210687Seric int class; 81310687Seric char *word; 81410687Seric { 81510687Seric register STAB *s; 81610687Seric 81710687Seric s = stab(word, ST_CLASS, ST_ENTER); 81810687Seric setbitn(class, s->s_class); 81910687Seric } 820