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
-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.
"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,
"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,
# 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.
bool oldverbose;
# ifdef DEBUG
bool oldverbose;
# ifdef DEBUG
- printf("\nSend Queue:\n");
+ printf("\nSENDALL: verify %d, sendqueue:\n");
printaddr(e->e_sendqueue, TRUE);
}
# endif DEBUG
printaddr(e->e_sendqueue, TRUE);
}
# endif DEBUG
+# 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)
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);
# 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.
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;
}
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)
{
-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,
-};
-
- register struct prio *pl;
- 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);
+
+ /* 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
# 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.
** 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)
-SCCSID(@(#)readcf.c 3.31 %G%);
+SCCSID(@(#)readcf.c 3.32 %G%);
/*
** READCF -- read control file.
/*
** READCF -- read control file.
** 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.
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\"",
# 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
- 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;
# 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
# 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.
** 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 */
#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/*
-static char SccsId[] = "@(#)SendMail version 3.203 of %G%";
+static char SccsId[] = "@(#)SendMail version 3.204 of %G%";
-char Version[] = "3.203 [%G%]";
+char Version[] = "3.204 [%G%]";