arrange to be able to define options; put precedences in .cf file;
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 25 Sep 1982 00:38:57 +0000 (16:38 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 25 Sep 1982 00:38:57 +0000 (16:38 -0800)
send errors to an Errors-To: field; fix a serious bug causing mail
to not be delivered to anyone if there were any errors.

SCCS-vsn: usr.sbin/sendmail/src/main.c 3.115
SCCS-vsn: usr.sbin/sendmail/src/conf.c 3.57
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 3.116
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 3.88
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 3.44
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.204
SCCS-vsn: usr.sbin/sendmail/src/readcf.c 3.32
SCCS-vsn: usr.sbin/sendmail/src/headers.c 3.35

usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/headers.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/readcf.c
usr/src/usr.sbin/sendmail/src/savemail.c
usr/src/usr.sbin/sendmail/src/sendmail.h
usr/src/usr.sbin/sendmail/src/version.c

index 5e72735..e5fed2b 100644 (file)
@@ -36,7 +36,7 @@
 
 
 
 
 
 
-SCCSID(@(#)conf.c      3.56            %G%);
+SCCSID(@(#)conf.c      3.57            %G%);
 \f/*
 **  Header info table
 **     Final (null) entry contains the flags used for any other field.
 \f/*
 **  Header info table
 **     Final (null) entry contains the flags used for any other field.
@@ -59,10 +59,10 @@ struct hdrinfo      HdrInfo[] =
        "resent-from",          H_FROM,                 0,
        "sender",               H_FROM,                 0,
        "from",                 H_FROM|H_CHECK,         M_NEEDFROM,
        "resent-from",          H_FROM,                 0,
        "sender",               H_FROM,                 0,
        "from",                 H_FROM|H_CHECK,         M_NEEDFROM,
-       "original-from",        0,                      0,
        "full-name",            H_ACHECK,               M_FULLNAME,
        "received-from",        H_CHECK,                M_LOCAL,
        "return-receipt-to",    H_FROM,                 0,
        "full-name",            H_ACHECK,               M_FULLNAME,
        "received-from",        H_CHECK,                M_LOCAL,
        "return-receipt-to",    H_FROM,                 0,
+       "errors-to",            H_FROM,                 0,
                /* destination fields */
        "to",                   H_RCPT,                 0,
        "resent-to",            H_RCPT,                 0,
                /* destination fields */
        "to",                   H_RCPT,                 0,
        "resent-to",            H_RCPT,                 0,
index 112cfd8..15b946a 100644 (file)
@@ -3,7 +3,7 @@
 # include "sendmail.h"
 # include <sys/stat.h>
 
 # include "sendmail.h"
 # include <sys/stat.h>
 
-SCCSID(@(#)deliver.c   3.115           %G%);
+SCCSID(@(#)deliver.c   3.116           %G%);
 
 /*
 **  DELIVER -- Deliver a message to a list of addresses.
 
 /*
 **  DELIVER -- Deliver a message to a list of addresses.
@@ -1399,9 +1399,9 @@ sendall(e, verifyonly)
        bool oldverbose;
 
 # ifdef DEBUG
        bool oldverbose;
 
 # ifdef DEBUG
-       if (tTd(13, 2))
+       if (tTd(13, 1))
        {
        {
-               printf("\nSend Queue:\n");
+               printf("\nSENDALL: verify %d, sendqueue:\n");
                printaddr(e->e_sendqueue, TRUE);
        }
 # endif DEBUG
                printaddr(e->e_sendqueue, TRUE);
        }
 # endif DEBUG
@@ -1437,10 +1437,16 @@ sendall(e, verifyonly)
        {
                register ADDRESS *qq;
 
        {
                register ADDRESS *qq;
 
+# ifdef DEBUG
+               if (tTd(13, 3))
+               {
+                       printf("Checking ");
+                       printaddr(q, FALSE);
+               }
+# endif DEBUG
+
                if (bitset(QQUEUEUP, q->q_flags))
                        e->e_queueup = TRUE;
                if (bitset(QQUEUEUP, q->q_flags))
                        e->e_queueup = TRUE;
-               if (!bitset(QBADADDR, q->q_flags))
-                       continue;
 
                /* we have an address that failed -- find the parent */
                for (qq = q; qq != NULL; qq = qq->q_alias)
 
                /* we have an address that failed -- find the parent */
                for (qq = q; qq != NULL; qq = qq->q_alias)
@@ -1461,6 +1467,20 @@ sendall(e, verifyonly)
                        if (aliaslookup(obuf) == NULL)
                                continue;
 
                        if (aliaslookup(obuf) == NULL)
                                continue;
 
+# ifdef DEBUG
+                       if (tTd(13, 4))
+                               printf("Errors to %s\n", obuf);
+# endif DEBUG
+
+                       /* add in an errors-to field */
+                               /*   ugh... must happen before delivery.....
+                       addheader("errors-to", newstr(obuf), e);
+                               .... i guess this should go in sendto */
+
+                       /* only send errors if the message failed */
+                       if (!bitset(QBADADDR, q->q_flags))
+                               break;
+
                        /* owner list exists -- add it to the error queue */
                        qq->q_flags &= ~QPRIMARY;
                        sendto(obuf, qq, &e->e_errorqueue);
                        /* owner list exists -- add it to the error queue */
                        qq->q_flags &= ~QPRIMARY;
                        sendto(obuf, qq, &e->e_errorqueue);
index c37fd90..44f7092 100644 (file)
@@ -1,7 +1,7 @@
 # include <errno.h>
 # include "sendmail.h"
 
 # include <errno.h>
 # include "sendmail.h"
 
-SCCSID(@(#)headers.c   3.34            %G%);
+SCCSID(@(#)headers.c   3.35            %G%);
 
 /*
 **  CHOMPHEADER -- process and save a header line.
 
 /*
 **  CHOMPHEADER -- process and save a header line.
@@ -373,8 +373,6 @@ eatheader()
                p = hvalue("precedence");
                if (p != NULL)
                        CurEnv->e_class = priencode(p);
                p = hvalue("precedence");
                if (p != NULL)
                        CurEnv->e_class = priencode(p);
-               else
-                       CurEnv->e_class = PRI_NORMAL;
                CurEnv->e_msgpriority -= CurEnv->e_class * WKPRIFACT;
        }
 
                CurEnv->e_msgpriority -= CurEnv->e_class * WKPRIFACT;
        }
 
@@ -383,6 +381,11 @@ eatheader()
        if (p != NULL)
                CurEnv->e_receiptto = p;
 
        if (p != NULL)
                CurEnv->e_receiptto = p;
 
+       /* errors to */
+       p = hvalue("errors-to");
+       if (p != NULL)
+               sendto(p, (ADDRESS *) NULL, &CurEnv->e_errorqueue);
+
        /* from person */
        if (ArpaMode)
        {
        /* from person */
        if (ArpaMode)
        {
@@ -427,36 +430,20 @@ eatheader()
 **             none.
 */
 
 **             none.
 */
 
-struct prio
-{
-       char    *pri_name;      /* external name of priority */
-       int     pri_val;        /* internal value for same */
-};
-
-static struct prio     Prio[] =
-{
-       "alert",                PRI_ALERT,
-       "quick",                PRI_QUICK,
-       "first-class",          PRI_FIRSTCL,
-       "normal",               PRI_NORMAL,
-       "second-class",         PRI_SECONDCL,
-       "third-class",          PRI_THIRDCL,
-       "junk",                 PRI_JUNK,
-       NULL,                   PRI_NORMAL,
-};
-
 priencode(p)
        char *p;
 {
 priencode(p)
        char *p;
 {
-       register struct prio *pl;
+       register int i;
        extern bool sameword();
 
        extern bool sameword();
 
-       for (pl = Prio; pl->pri_name != NULL; pl++)
+       for (i = 0; i < NumPriorities; i++)
        {
        {
-               if (sameword(p, pl->pri_name))
-                       break;
+               if (sameword(p, Priorities[i].pri_name))
+                       return (Priorities[i].pri_val);
        }
        }
-       return (pl->pri_val);
+
+       /* unknown priority */
+       return (0);
 }
 \f/*
 **  CRACKADDR -- parse an address and turn it into a macro
 }
 \f/*
 **  CRACKADDR -- parse an address and turn it into a macro
index d59f6a3..dc50845 100644 (file)
@@ -6,7 +6,7 @@
 # include "sendmail.h"
 # include <sys/stat.h>
 
 # include "sendmail.h"
 # include <sys/stat.h>
 
-SCCSID(@(#)main.c      3.114           %G%);
+SCCSID(@(#)main.c      3.115           %G%);
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
@@ -611,13 +611,8 @@ main(argc, argv)
        **      If the fork fails, we will just continue in the
        **              parent; this is perfectly safe, albeit
        **              slower than it must be.
        **      If the fork fails, we will just continue in the
        **              parent; this is perfectly safe, albeit
        **              slower than it must be.
-       **      If we have errors sofar, this seems like a good time
-       **              to dispose of them.
        */
 
        */
 
-       if (ExitStat != EX_OK && Mode != MD_VERIFY)
-               finis();
-
        if (Mode == MD_FORK)
        {
                if (fork() > 0)
        if (Mode == MD_FORK)
        {
                if (fork() > 0)
index 79b9220..6f3926c 100644 (file)
@@ -1,6 +1,6 @@
 # include "sendmail.h"
 
 # include "sendmail.h"
 
-SCCSID(@(#)readcf.c    3.31            %G%);
+SCCSID(@(#)readcf.c    3.32            %G%);
 
 /*
 **  READCF -- read control file.
 
 /*
 **  READCF -- read control file.
@@ -24,9 +24,12 @@ SCCSID(@(#)readcf.c  3.31            %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 r a      Define mailer.  n - internal name,
-**                             p - pathname, f - flags, r - rewriting
-**                             rule for sender, a - argument vector.
+**             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.
+**             Oxvalue         Set option x to value.
+**             Pname=value     Set precedence name to value.
 **
 **     Parameters:
 **             cfname -- control file name.
 **
 **     Parameters:
 **             cfname -- control file name.
@@ -191,6 +194,30 @@ readcf(cfname, safe)
                        makemailer(&buf[1], safe);
                        break;
 
                        makemailer(&buf[1], safe);
                        break;
 
+                 case 'O':             /* set option */
+                       if (buf[2] == '\0')
+                               Option[buf[1]] = "";
+                       else
+                               Option[buf[1]] = newstr(&buf[2]);
+                       break;
+
+                 case 'P':             /* set precedence */
+                       if (NumPriorities >= MAXPRIORITIES)
+                       {
+                               syserr("readcf: line %d: too many P lines, %d max",
+                                       LineNumber, MAXPRIORITIES);
+                               break;
+                       }
+                       for (p = &buf[1]; *p != '\0' && *p != '='; p++)
+                               continue;
+                       if (*p == '\0')
+                               goto badline;
+                       *p = '\0';
+                       Priorities[NumPriorities].pri_name = newstr(&buf[1]);
+                       Priorities[NumPriorities].pri_val = atoi(++p);
+                       NumPriorities++;
+                       break;
+
                  default:
                  badline:
                        syserr("readcf: line %d: unknown control line \"%s\"",
                  default:
                  badline:
                        syserr("readcf: line %d: unknown control line \"%s\"",
index 733806a..5910ede 100644 (file)
@@ -1,7 +1,7 @@
 # include <pwd.h>
 # include "sendmail.h"
 
 # include <pwd.h>
 # include "sendmail.h"
 
-SCCSID(@(#)savemail.c  3.43            %G%);
+SCCSID(@(#)savemail.c  3.44            %G%);
 
 /*
 **  SAVEMAIL -- Save mail on error
 
 /*
 **  SAVEMAIL -- Save mail on error
@@ -41,7 +41,7 @@ savemail()
 
        if (exclusive++)
                return;
 
        if (exclusive++)
                return;
-       if (CurEnv->e_class <= PRI_JUNK)
+       if (CurEnv->e_class < 0)
        {
                message(Arpa_Info, "Dumping junk mail");
                return;
        {
                message(Arpa_Info, "Dumping junk mail");
                return;
index 5373730..e3afa7d 100644 (file)
@@ -7,7 +7,7 @@
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
-static char SmailSccsId[] =    "@(#)sendmail.h 3.87            %G%";
+static char SmailSccsId[] =    "@(#)sendmail.h 3.88            %G%";
 # endif lint
 # else  _DEFINE
 # define EXTERN extern
 # endif lint
 # else  _DEFINE
 # define EXTERN extern
@@ -35,6 +35,7 @@ static char SmailSccsId[] =   "@(#)sendmail.h 3.87            %G%";
 # define MAXATOM       100             /* max atoms per address */
 # define MAXMAILERS    25              /* maximum mailers known to system */
 # define MAXRWSETS     30              /* max # of sets of rewriting rules */
 # define MAXATOM       100             /* max atoms per address */
 # define MAXMAILERS    25              /* maximum mailers known to system */
 # define MAXRWSETS     30              /* max # of sets of rewriting rules */
+# define MAXPRIORITIES 25              /* max values for Precedence: field */
 # define SPACESUB      ('.'|0200)      /* substitution for <lwsp> */
 \f/*
 **  Address structure.
 # define SPACESUB      ('.'|0200)      /* substitution for <lwsp> */
 \f/*
 **  Address structure.
@@ -242,13 +243,14 @@ EXTERN WORK       *WorkQ;                 /* queue of things to be done */
 **     error messages thrown away if they are not local.
 */
 
 **     error messages thrown away if they are not local.
 */
 
-# define PRI_ALERT     50
-# define PRI_QUICK     30
-# define PRI_FIRSTCL   10
-# define PRI_NORMAL    0
-# define PRI_SECONDCL  -10
-# define PRI_THIRDCL   -40
-# define PRI_JUNK      -100
+struct priority
+{
+       char    *pri_name;      /* external name of priority */
+       int     pri_val;        /* internal value for same */
+};
+
+EXTERN struct priority Priorities[MAXPRIORITIES];
+EXTERN int             NumPriorities;  /* pointer into Priorities */
 
 # define WKPRIFACT     1800            /* bytes each pri point is worth */
 # define WKTIMEFACT    400             /* bytes each time unit is worth */
 
 # define WKPRIFACT     1800            /* bytes each pri point is worth */
 # define WKTIMEFACT    400             /* bytes each time unit is worth */
@@ -380,6 +382,17 @@ EXTERN char        Mode;           /* operation mode, see below */
 
 #define MD_DEFAULT     MD_DELIVER      /* default operation mode */
 \f/*
 
 #define MD_DEFAULT     MD_DELIVER      /* default operation mode */
 \f/*
+**  Options
+**
+**     These are assorted options that can be set from the configuration
+**     file.
+*/
+
+EXTERN char    *Option[128];   /* miscellaneous option values */
+
+/* option values */
+# define       OPT_QUEUEALL    'q'     /* force all messages to queue */
+\f/*
 **  Global variables.
 */
 
 **  Global variables.
 */
 
index bdb2e1c..958da76 100644 (file)
@@ -1,5 +1,5 @@
 # ifndef lint
 # ifndef lint
-static char    SccsId[] = "@(#)SendMail version 3.203 of %G%";
+static char    SccsId[] = "@(#)SendMail version 3.204 of %G%";
 # endif lint
 
 # endif lint
 
-char   Version[] = "3.203 [%G%]";
+char   Version[] = "3.204 [%G%]";