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