BSD 4_3_Net_2 release
[unix-history] / usr / src / usr.sbin / sendmail / src / readcf.c
index c0e7a62..bd2bad7 100644 (file)
@@ -1,6 +1,42 @@
-# include "sendmail.h"
+/*
+ * Copyright (c) 1983 Eric P. Allman
+ * Copyright (c) 1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)readcf.c   5.22 (Berkeley) 3/12/91";
+#endif /* not lint */
 
 
-SCCSID(@(#)readcf.c    3.52            %G%);
+# include "sendmail.h"
 
 /*
 **  READCF -- read control file.
 
 /*
 **  READCF -- read control file.
@@ -24,19 +60,13 @@ SCCSID(@(#)readcf.c 3.52            %G%);
 **             Sn              Use rewriting set n.
 **             Rlhs rhs        Rewrite addresses that match lhs to
 **                             be rhs.
 **             Sn              Use rewriting set n.
 **             Rlhs rhs        Rewrite addresses that match lhs to
 **                             be rhs.
-**             Mn p f s r a    Define mailer.  n - internal name,
-**                             p - pathname, f - flags, s - rewriting
-**                             ruleset for sender, s - rewriting ruleset
-**                             for recipients, a - argument vector.
+**             Mn arg=val...   Define mailer.  n is the internal name.
+**                             Args specify mailer parameters.
 **             Oxvalue         Set option x to value.
 **             Pname=value     Set precedence name to value.
 **
 **     Parameters:
 **             cfname -- control file name.
 **             Oxvalue         Set option x to value.
 **             Pname=value     Set precedence name to value.
 **
 **     Parameters:
 **             cfname -- control file name.
-**             safe -- set if this is a system configuration file.
-**                     Non-system configuration files can not do
-**                     certain things (e.g., leave the SUID bit on
-**                     when executing mailers).
 **
 **     Returns:
 **             none.
 **
 **     Returns:
 **             none.
@@ -45,12 +75,10 @@ SCCSID(@(#)readcf.c 3.52            %G%);
 **             Builds several internal tables.
 */
 
 **             Builds several internal tables.
 */
 
-readcf(cfname, safe)
+readcf(cfname)
        char *cfname;
        char *cfname;
-       bool safe;
 {
        FILE *cf;
 {
        FILE *cf;
-       int class;
        int ruleset = 0;
        char *q;
        char **pv;
        int ruleset = 0;
        char *q;
        char **pv;
@@ -60,7 +88,9 @@ readcf(cfname, safe)
        extern char **prescan();
        extern char **copyplist();
        char exbuf[MAXLINE];
        extern char **prescan();
        extern char **copyplist();
        char exbuf[MAXLINE];
+       char pvpbuf[PSBUFSIZE];
        extern char *fgetfolded();
        extern char *fgetfolded();
+       extern char *munchstring();
 
        cf = fopen(cfname, "r");
        if (cf == NULL)
 
        cf = fopen(cfname, "r");
        if (cf == NULL)
@@ -73,6 +103,24 @@ readcf(cfname, safe)
        LineNumber = 0;
        while (fgetfolded(buf, sizeof buf, cf) != NULL)
        {
        LineNumber = 0;
        while (fgetfolded(buf, sizeof buf, cf) != NULL)
        {
+               /* map $ into \001 (ASCII SOH) for macro expansion */
+               for (p = buf; *p != '\0'; p++)
+               {
+                       if (*p != '$')
+                               continue;
+
+                       if (p[1] == '$')
+                       {
+                               /* actual dollar sign.... */
+                               (void) strcpy(p, p + 1);
+                               continue;
+                       }
+
+                       /* convert to macro expansion character */
+                       *p = '\001';
+               }
+
+               /* interpret this line */
                switch (buf[0])
                {
                  case '\0':
                switch (buf[0])
                {
                  case '\0':
@@ -105,7 +153,7 @@ readcf(cfname, safe)
                        /* expand and save the LHS */
                        *p = '\0';
                        expand(&buf[1], exbuf, &exbuf[sizeof exbuf], CurEnv);
                        /* expand and save the LHS */
                        *p = '\0';
                        expand(&buf[1], exbuf, &exbuf[sizeof exbuf], CurEnv);
-                       rwp->r_lhs = prescan(exbuf, '\t');
+                       rwp->r_lhs = prescan(exbuf, '\t', pvpbuf);
                        if (rwp->r_lhs != NULL)
                                rwp->r_lhs = copyplist(rwp->r_lhs, TRUE);
 
                        if (rwp->r_lhs != NULL)
                                rwp->r_lhs = copyplist(rwp->r_lhs, TRUE);
 
@@ -117,7 +165,7 @@ readcf(cfname, safe)
                                p++;
                        *p = '\0';
                        expand(q, exbuf, &exbuf[sizeof exbuf], CurEnv);
                                p++;
                        *p = '\0';
                        expand(q, exbuf, &exbuf[sizeof exbuf], CurEnv);
-                       rwp->r_rhs = prescan(exbuf, '\t');
+                       rwp->r_rhs = prescan(exbuf, '\t', pvpbuf);
                        if (rwp->r_rhs != NULL)
                                rwp->r_rhs = copyplist(rwp->r_rhs, TRUE);
                        break;
                        if (rwp->r_rhs != NULL)
                                rwp->r_rhs = copyplist(rwp->r_rhs, TRUE);
                        break;
@@ -133,7 +181,7 @@ readcf(cfname, safe)
                        break;
 
                  case 'D':             /* macro definition */
                        break;
 
                  case 'D':             /* macro definition */
-                       define(buf[1], newstr(&buf[2]), CurEnv);
+                       define(buf[1], newstr(munchstring(&buf[2])), CurEnv);
                        break;
 
                  case 'H':             /* required header line */
                        break;
 
                  case 'H':             /* required header line */
@@ -142,17 +190,6 @@ readcf(cfname, safe)
 
                  case 'C':             /* word class */
                  case 'F':             /* word class from file */
 
                  case 'C':             /* word class */
                  case 'F':             /* word class from file */
-                       class = buf[1];
-                       if (!isalpha(class))
-                       {
-                               syserr("illegal class name %c", class);
-                               break;
-                       }
-                       if (isupper(class))
-                               class -= 'A';
-                       else
-                               class -= 'a';
-                       
                        /* read list of words from argument or file */
                        if (buf[0] == 'F')
                        {
                        /* read list of words from argument or file */
                        if (buf[0] == 'F')
                        {
@@ -167,7 +204,7 @@ readcf(cfname, safe)
                                        while (isspace(*++p))
                                                continue;
                                }
                                        while (isspace(*++p))
                                                continue;
                                }
-                               fileclass(class, &buf[2], p);
+                               fileclass(buf[1], &buf[2], p);
                                break;
                        }
 
                                break;
                        }
 
@@ -176,7 +213,6 @@ readcf(cfname, safe)
                        {
                                register char *wd;
                                char delim;
                        {
                                register char *wd;
                                char delim;
-                               register STAB *s;
 
                                while (*p != '\0' && isspace(*p))
                                        p++;
 
                                while (*p != '\0' && isspace(*p))
                                        p++;
@@ -186,20 +222,17 @@ readcf(cfname, safe)
                                delim = *p;
                                *p = '\0';
                                if (wd[0] != '\0')
                                delim = *p;
                                *p = '\0';
                                if (wd[0] != '\0')
-                               {
-                                       s = stab(wd, ST_CLASS, ST_ENTER);
-                                       s->s_class |= 1L << class;
-                               }
+                                       setclass(buf[1], wd);
                                *p = delim;
                        }
                        break;
 
                  case 'M':             /* define mailer */
                                *p = delim;
                        }
                        break;
 
                  case 'M':             /* define mailer */
-                       makemailer(&buf[1], safe);
+                       makemailer(&buf[1]);
                        break;
 
                  case 'O':             /* set option */
                        break;
 
                  case 'O':             /* set option */
-                       setoption(buf[1], &buf[2], safe, FALSE);
+                       setoption(buf[1], &buf[2], TRUE, FALSE);
                        break;
 
                  case 'P':             /* set precedence */
                        break;
 
                  case 'P':             /* set precedence */
@@ -291,7 +324,7 @@ fileclass(class, filename, fmt)
        char *filename;
        char *fmt;
 {
        char *filename;
        char *fmt;
 {
-       register FILE *f;
+       FILE *f;
        char buf[MAXLINE];
 
        f = fopen(filename, "r");
        char buf[MAXLINE];
 
        f = fopen(filename, "r");
@@ -304,12 +337,42 @@ fileclass(class, filename, fmt)
        while (fgets(buf, sizeof buf, f) != NULL)
        {
                register STAB *s;
        while (fgets(buf, sizeof buf, f) != NULL)
        {
                register STAB *s;
+               register char *p;
+# ifdef SCANF
                char wordbuf[MAXNAME+1];
 
                if (sscanf(buf, fmt, wordbuf) != 1)
                        continue;
                char wordbuf[MAXNAME+1];
 
                if (sscanf(buf, fmt, wordbuf) != 1)
                        continue;
-               s = stab(wordbuf, ST_CLASS, ST_ENTER);
-               s->s_class |= 1L << class;
+               p = wordbuf;
+# else SCANF
+               p = buf;
+# endif SCANF
+
+               /*
+               **  Break up the match into words.
+               */
+
+               while (*p != '\0')
+               {
+                       register char *q;
+
+                       /* strip leading spaces */
+                       while (isspace(*p))
+                               p++;
+                       if (*p == '\0')
+                               break;
+
+                       /* find the end of the word */
+                       q = p;
+                       while (*p != '\0' && !isspace(*p))
+                               p++;
+                       if (*p != '\0')
+                               *p++ = '\0';
+
+                       /* enter the word in the symbol table */
+                       s = stab(q, ST_CLASS, ST_ENTER);
+                       setbitn(class, s->s_class);
+               }
        }
 
        (void) fclose(f);
        }
 
        (void) fclose(f);
@@ -327,7 +390,6 @@ fileclass(class, filename, fmt)
 **                        R -- the recipient rewriting set
 **                        E -- the eol string
 **                     The first word is the canonical name of the mailer.
 **                        R -- the recipient rewriting set
 **                        E -- the eol string
 **                     The first word is the canonical name of the mailer.
-**             safe -- set if this is a safe configuration file.
 **
 **     Returns:
 **             none.
 **
 **     Returns:
 **             none.
@@ -336,20 +398,19 @@ fileclass(class, filename, fmt)
 **             enters the mailer into the mailer table.
 */
 
 **             enters the mailer into the mailer table.
 */
 
-makemailer(line, safe)
+makemailer(line)
        char *line;
        char *line;
-       bool safe;
 {
        register char *p;
        register struct mailer *m;
        register STAB *s;
        int i;
        char fcode;
 {
        register char *p;
        register struct mailer *m;
        register STAB *s;
        int i;
        char fcode;
-       extern u_long mfencode();
        extern int NextMailer;
        extern char **makeargv();
        extern char *munchstring();
        extern char *DelimChar;
        extern int NextMailer;
        extern char **makeargv();
        extern char *munchstring();
        extern char *DelimChar;
+       extern long atol();
 
        /* allocate a mailer and set up defaults */
        m = (struct mailer *) xalloc(sizeof *m);
 
        /* allocate a mailer and set up defaults */
        m = (struct mailer *) xalloc(sizeof *m);
@@ -393,9 +454,8 @@ makemailer(line, safe)
                        break;
 
                  case 'F':             /* flags */
                        break;
 
                  case 'F':             /* flags */
-                       m->m_flags = mfencode(p);
-                       if (!safe)
-                               m->m_flags &= ~M_RESTR;
+                       for (; *p != '\0'; p++)
+                               setbitn(*p, m->m_flags);
                        break;
 
                  case 'S':             /* sender rewriting ruleset */
                        break;
 
                  case 'S':             /* sender rewriting ruleset */
@@ -419,6 +479,10 @@ makemailer(line, safe)
                  case 'A':             /* argument vector */
                        m->m_argv = makeargv(p);
                        break;
                  case 'A':             /* argument vector */
                        m->m_argv = makeargv(p);
                        break;
+
+                 case 'M':             /* maximum message size */
+                       m->m_maxsize = atol(p);
+                       break;
                }
 
                p = DelimChar;
                }
 
                p = DelimChar;
@@ -538,7 +602,7 @@ makeargv(p)
 
        /* now make a copy of the argv */
        avp = (char **) xalloc(sizeof *avp * i);
 
        /* now make a copy of the argv */
        avp = (char **) xalloc(sizeof *avp * i);
-       bmove((char *) argv, (char *) avp, sizeof *avp * i);
+       bcopy((char *) argv, (char *) avp, sizeof *avp * i);
 
        return (avp);
 }
 
        return (avp);
 }
@@ -555,8 +619,6 @@ makeargv(p)
 **             prints rewrite rules.
 */
 
 **             prints rewrite rules.
 */
 
-# ifdef DEBUG
-
 printrules()
 {
        register struct rewrite *rwp;
 printrules()
 {
        register struct rewrite *rwp;
@@ -578,109 +640,15 @@ printrules()
        }
 }
 
        }
 }
 
-# endif DEBUG
-\f/*
-**  MFENCODE -- crack mailer options
-**
-**     These options modify the functioning of the mailer
-**     from the configuration table.
-**
-**     Parameters:
-**             p -- pointer to vector of options.
-**
-**     Returns:
-**             option list in binary.
-**
-**     Side Effects:
-**             none.
-*/
-
-struct optlist
-{
-       char    opt_name;       /* external name of option */
-       u_long  opt_value;      /* internal name of option */
-};
-struct optlist OptList[] =
-{
-       'A',    M_ARPAFMT,
-       'C',    M_CANONICAL,
-       'D',    M_NEEDDATE,
-       'e',    M_EXPENSIVE,
-       'F',    M_NEEDFROM,
-       'f',    M_FOPT,
-       'h',    M_HST_UPPER,
-       'I',    M_INTERNAL,
-       'L',    M_LIMITS,
-       'l',    M_LOCAL,
-       'M',    M_MSGID,
-       'm',    M_MUSER,
-       'n',    M_NHDR,
-       'P',    M_RPATH,
-       'p',    M_FROMPATH,
-       'r',    M_ROPT,
-       'S',    M_RESTR,
-       's',    M_STRIPQ,
-       'U',    M_UGLYUUCP,
-       'u',    M_USR_UPPER,
-       'x',    M_FULLNAME,
-       'X',    M_XDOT,
-       '\0',   0
-};
-
-u_long
-mfencode(p)
-       register char *p;
-{
-       register struct optlist *o;
-       register u_long opts = 0;
-
-       while (*p != '\0')
-       {
-               for (o = OptList; o->opt_name != '\0' && o->opt_name != *p; o++)
-                       continue;
-               opts |= o->opt_value;
-               p++;
-       }
-       return (opts);
-}
-\f/*
-**  MFDECODE -- decode mailer flags into external form.
-**
-**     Parameters:
-**             flags -- value of flags to decode.
-**             f -- file to write them onto.
-**
-**     Returns:
-**             none.
-**
-**     Side Effects:
-**             none.
-*/
-
-mfdecode(flags, f)
-       u_long flags;
-       FILE *f;
-{
-       register struct optlist *o;
-
-       putc('?', f);
-       for (o = OptList; o->opt_name != '\0'; o++)
-       {
-               if ((o->opt_value & flags) == o->opt_value)
-               {
-                       flags &= ~o->opt_value;
-                       putc(o->opt_name, f);
-               }
-       }
-       putc('?', f);
-}
 \f/*
 **  SETOPTION -- set global processing option
 **
 **     Parameters:
 **             opt -- option name.
 **             val -- option value (as a text string).
 \f/*
 **  SETOPTION -- set global processing option
 **
 **     Parameters:
 **             opt -- option name.
 **             val -- option value (as a text string).
-**             safe -- if set, this came from a system configuration file.
+**             safe -- set if this came from a configuration file.
+**                     Some options (if set from the command line) will
+**                     reset the user id to avoid security problems.
 **             sticky -- if set, don't let other setoptions override
 **                     this value.
 **
 **             sticky -- if set, don't let other setoptions override
 **                     this value.
 **
@@ -691,11 +659,8 @@ mfdecode(flags, f)
 **             Sets options as implied by the arguments.
 */
 
 **             Sets options as implied by the arguments.
 */
 
-static int     StickyOpt[128 / sizeof (int)];  /* set if option is stuck */
-extern char    *WizWord;                       /* the stored wizard password */
-#ifdef DAEMON
-extern int     MaxConnections;                 /* max simult. SMTP conns */
-#endif DAEMON
+static BITMAP  StickyOpt;              /* set if option is stuck */
+extern char    *NetName;               /* name of home (local) network */
 
 setoption(opt, val, safe, sticky)
        char opt;
 
 setoption(opt, val, safe, sticky)
        char opt;
@@ -703,39 +668,49 @@ setoption(opt, val, safe, sticky)
        bool safe;
        bool sticky;
 {
        bool safe;
        bool sticky;
 {
-       int smask;
-       int sindex;
        extern bool atobool();
        extern bool atobool();
+       extern time_t convtime();
+       extern int QueueLA;
+       extern int RefuseLA;
+       extern bool trusteduser();
+       extern char *username();
 
 
-# ifdef DEBUG
        if (tTd(37, 1))
                printf("setoption %c=%s", opt, val);
        if (tTd(37, 1))
                printf("setoption %c=%s", opt, val);
-# endif DEBUG
 
        /*
        **  See if this option is preset for us.
        */
 
 
        /*
        **  See if this option is preset for us.
        */
 
-       sindex = opt;
-       smask = 1 << (sindex % sizeof (int));
-       sindex /= sizeof (int);
-       if (bitset(smask, StickyOpt[sindex]))
+       if (bitnset(opt, StickyOpt))
        {
        {
-# ifdef DEBUG
                if (tTd(37, 1))
                        printf(" (ignored)\n");
                if (tTd(37, 1))
                        printf(" (ignored)\n");
-# endif DEBUG
                return;
        }
                return;
        }
-#ifdef DEBUG
-       else if (tTd(37, 1))
-               printf("\n");
-#endif DEBUG
-       if (sticky)
-               StickyOpt[sindex] |= smask;
 
 
-       if (getruid() == 0)
+       /*
+       **  Check to see if this option can be specified by this user.
+       */
+
+       if (!safe && getuid() == 0)
                safe = TRUE;
                safe = TRUE;
+       if (!safe && index("deiLmorsv", opt) == NULL)
+       {
+               if (opt != 'M' || (val[0] != 'r' && val[0] != 's'))
+               {
+                       if (tTd(37, 1))
+                               printf(" (unsafe)");
+                       if (getuid() != geteuid())
+                       {
+                               printf("(Resetting uid)\n");
+                               (void) setgid(getgid());
+                               (void) setuid(getuid());
+                       }
+               }
+       }
+       else if (tTd(37, 1))
+               printf("\n");
 
        switch (opt)
        {
 
        switch (opt)
        {
@@ -746,14 +721,27 @@ setoption(opt, val, safe, sticky)
                        AliasFile = newstr(val);
                break;
 
                        AliasFile = newstr(val);
                break;
 
-         case 'a':             /* look for "@:@" in alias file */
-               SafeAlias = atobool(val);
+         case 'a':             /* look N minutes for "@:@" in alias file */
+               if (val[0] == '\0')
+                       SafeAlias = 5;
+               else
+                       SafeAlias = atoi(val);
+               break;
+
+         case 'B':             /* substitution for blank character */
+               SpaceSub = val[0];
+               if (SpaceSub == '\0')
+                       SpaceSub = ' ';
                break;
 
          case 'c':             /* don't connect to "expensive" mailers */
                NoConnect = atobool(val);
                break;
 
                break;
 
          case 'c':             /* don't connect to "expensive" mailers */
                NoConnect = atobool(val);
                break;
 
+         case 'C':             /* checkpoint after N connections */
+               CheckPointLimit = atoi(val);
+               break;
+
          case 'd':             /* delivery mode */
                switch (*val)
                {
          case 'd':             /* delivery mode */
                switch (*val)
                {
@@ -761,9 +749,14 @@ setoption(opt, val, safe, sticky)
                        SendMode = SM_DELIVER;
                        break;
 
                        SendMode = SM_DELIVER;
                        break;
 
+                 case SM_QUEUE:        /* queue only */
+#ifndef QUEUE
+                       syserr("need QUEUE to set -odqueue");
+#endif QUEUE
+                       /* fall through..... */
+
                  case SM_DELIVER:      /* do everything */
                  case SM_FORK:         /* fork after verification */
                  case SM_DELIVER:      /* do everything */
                  case SM_FORK:         /* fork after verification */
-                 case SM_QUEUE:        /* queue only */
                        SendMode = *val;
                        break;
 
                        SendMode = *val;
                        break;
 
@@ -781,9 +774,6 @@ setoption(opt, val, safe, sticky)
                switch (*val)
                {
                  case EM_QUIET:        /* be silent about it */
                switch (*val)
                {
                  case EM_QUIET:        /* be silent about it */
-                       (void) freopen("/dev/null", "w", stdout);
-                       /* fall through... */
-
                  case EM_MAIL:         /* mail back */
                  case EM_BERKNET:      /* do berknet error processing */
                  case EM_WRITE:        /* write back (or mail) */
                  case EM_MAIL:         /* mail back */
                  case EM_BERKNET:      /* do berknet error processing */
                  case EM_WRITE:        /* write back (or mail) */
@@ -797,7 +787,7 @@ setoption(opt, val, safe, sticky)
                break;
 
          case 'F':             /* file mode */
                break;
 
          case 'F':             /* file mode */
-               FileMode = atooct(val);
+               FileMode = atooct(val) & 0777;
                break;
 
          case 'f':             /* save Unix-style From lines on front */
                break;
 
          case 'f':             /* save Unix-style From lines on front */
@@ -805,8 +795,7 @@ setoption(opt, val, safe, sticky)
                break;
 
          case 'g':             /* default gid */
                break;
 
          case 'g':             /* default gid */
-               if (safe)
-                       DefGid = atoi(val);
+               DefGid = atoi(val);
                break;
 
          case 'H':             /* help file */
                break;
 
          case 'H':             /* help file */
@@ -816,27 +805,40 @@ setoption(opt, val, safe, sticky)
                        HelpFile = newstr(val);
                break;
 
                        HelpFile = newstr(val);
                break;
 
+         case 'I':             /* use internet domain name server */
+               UseNameServer = atobool(val);
+               break;
+
          case 'i':             /* ignore dot lines in message */
                IgnrDot = atobool(val);
                break;
 
          case 'i':             /* ignore dot lines in message */
                IgnrDot = atobool(val);
                break;
 
+         case 'k':             /* checkpoint every N addresses */
+               CheckpointInterval = atoi(val);
+               break;
+
          case 'L':             /* log level */
                LogLevel = atoi(val);
                break;
 
          case 'M':             /* define macro */
                define(val[0], newstr(&val[1]), CurEnv);
          case 'L':             /* log level */
                LogLevel = atoi(val);
                break;
 
          case 'M':             /* define macro */
                define(val[0], newstr(&val[1]), CurEnv);
+               sticky = FALSE;
                break;
 
          case 'm':             /* send to me too */
                MeToo = atobool(val);
                break;
 
                break;
 
          case 'm':             /* send to me too */
                MeToo = atobool(val);
                break;
 
-#ifdef DAEMON
-         case 'N':             /* maximum simultaneous SMTP connections */
-               MaxConnections = atoi(val);
+         case 'n':             /* validate RHS in newaliases */
+               CheckAliases = atobool(val);
+               break;
+
+# ifdef DAEMON
+         case 'N':             /* home (local?) network name */
+               NetName = newstr(val);
                break;
                break;
-#endif DAEMON
+# endif DAEMON
 
          case 'o':             /* assume old style headers */
                if (atobool(val))
 
          case 'o':             /* assume old style headers */
                if (atobool(val))
@@ -845,6 +847,14 @@ setoption(opt, val, safe, sticky)
                        CurEnv->e_flags &= ~EF_OLDSTYLE;
                break;
 
                        CurEnv->e_flags &= ~EF_OLDSTYLE;
                break;
 
+         case 'P':             /* postmaster copy address for returned mail */
+               PostMasterCopy = newstr(val);
+               break;
+
+         case 'q':             /* slope of queue only function */
+               QueueFactor = atoi(val);
+               break;
+
          case 'Q':             /* queue directory */
                if (val[0] == '\0')
                        QueueDir = "mqueue";
          case 'Q':             /* queue directory */
                if (val[0] == '\0')
                        QueueDir = "mqueue";
@@ -869,37 +879,71 @@ setoption(opt, val, safe, sticky)
 
          case 'T':             /* queue timeout */
                TimeOut = convtime(val);
 
          case 'T':             /* queue timeout */
                TimeOut = convtime(val);
-               break;
+               /*FALLTHROUGH*/
 
          case 't':             /* time zone name */
 
          case 't':             /* time zone name */
-# ifdef V6
-               StdTimezone = newstr(val);
-               DstTimezone = index(StdTimeZone, ',');
-               if (DstTimezone == NULL)
-                       syserr("bad time zone spec");
-               else
-                       *DstTimezone++ = '\0';
-# endif V6
                break;
 
          case 'u':             /* set default uid */
                break;
 
          case 'u':             /* set default uid */
-               if (safe)
-                       DefUid = atoi(val);
+               DefUid = atoi(val);
+               setdefuser();
                break;
 
          case 'v':             /* run in verbose mode */
                Verbose = atobool(val);
                break;
 
                break;
 
          case 'v':             /* run in verbose mode */
                Verbose = atobool(val);
                break;
 
-# ifdef DEBUG
-         case 'W':             /* set the wizards password */
-               if (safe)
-                       WizWord = newstr(val);
+         case 'x':             /* load avg at which to auto-queue msgs */
+               QueueLA = atoi(val);
+               break;
+
+         case 'X':             /* load avg at which to auto-reject connections */
+               RefuseLA = atoi(val);
+               break;
+
+         case 'y':             /* work recipient factor */
+               WkRecipFact = atoi(val);
+               break;
+
+         case 'Y':             /* fork jobs during queue runs */
+               ForkQueueRuns = atobool(val);
+               break;
+
+         case 'z':             /* work message class factor */
+               WkClassFact = atoi(val);
+               break;
+
+         case 'Z':             /* work time factor */
+               WkTimeFact = atoi(val);
                break;
                break;
-# endif DEBUG
 
          default:
                break;
        }
 
          default:
                break;
        }
+       if (sticky)
+               setbitn(opt, StickyOpt);
        return;
 }
        return;
 }
+\f/*
+**  SETCLASS -- set a word into a class
+**
+**     Parameters:
+**             class -- the class to put the word in.
+**             word -- the word to enter
+**
+**     Returns:
+**             none.
+**
+**     Side Effects:
+**             puts the word into the symbol table.
+*/
+
+setclass(class, word)
+       int class;
+       char *word;
+{
+       register STAB *s;
+
+       s = stab(word, ST_CLASS, ST_ENTER);
+       setbitn(class, s->s_class);
+}