implement -c flag: don't try to deliver expensive mail immediately
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 21 Feb 1982 04:10:24 +0000 (20:10 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 21 Feb 1982 04:10:24 +0000 (20:10 -0800)
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 3.65
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 3.59
SCCS-vsn: usr.sbin/sendmail/src/main.c 3.62
SCCS-vsn: usr.sbin/sendmail/src/readcf.c 3.20

usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/readcf.c
usr/src/usr.sbin/sendmail/src/sendmail.h

index f58b1b5..ca936fa 100644 (file)
@@ -6,7 +6,7 @@
 # include <syslog.h>
 # endif LOG
 
 # include <syslog.h>
 # endif LOG
 
-SCCSID(@(#)deliver.c   3.64            %G%);
+SCCSID(@(#)deliver.c   3.65            %G%);
 
 /*
 **  DELIVER -- Deliver a message to a list of addresses.
 
 /*
 **  DELIVER -- Deliver a message to a list of addresses.
@@ -67,6 +67,28 @@ deliver(firstto, editfcn)
                        to->q_mailer->m_mno, to->q_host, to->q_user);
 # endif DEBUG
 
                        to->q_mailer->m_mno, to->q_host, to->q_user);
 # endif DEBUG
 
+       m = to->q_mailer;
+       host = to->q_host;
+
+       /*
+       **  If this mailer is expensive, and if we don't want to make
+       **  connections now, just mark these addresses and return.
+       **      This is useful if we want to batch connections to
+       **      reduce load.  This will cause the messages to be
+       **      queued up, and a daemon will come along to send the
+       **      messages later.
+       **              This should be on a per-mailer basis.
+       */
+
+       if (NoConnect && !QueueRun && bitset(M_EXPENSIVE, m->m_flags))
+       {
+               QueueUp = TRUE;
+               for (; to != NULL; to = to->q_next)
+                       if (!bitset(QDONTSEND, to->q_flags))
+                               to->q_flags |= QQUEUEUP|QDONTSEND;
+               return (0);
+       }
+
        /*
        **  Do initial argv setup.
        **      Insert the mailer name.  Notice that $x expansion is
        /*
        **  Do initial argv setup.
        **      Insert the mailer name.  Notice that $x expansion is
@@ -74,11 +96,11 @@ deliver(firstto, editfcn)
        **      a picky -f flag, we insert it as appropriate.  This
        **      code does not check for 'pv' overflow; this places a
        **      manifest lower limit of 4 for MAXPV.
        **      a picky -f flag, we insert it as appropriate.  This
        **      code does not check for 'pv' overflow; this places a
        **      manifest lower limit of 4 for MAXPV.
+       **              We rewrite the from address here, being careful
+       **              to also rewrite it again using ruleset 2 to
+       **              eliminate redundancies.
        */
 
        */
 
-       m = to->q_mailer;
-       host = to->q_host;
-
        /* rewrite from address, using rewriting rules */
        (void) expand(m->m_from, buf, &buf[sizeof buf - 1]);
        mvp = prescan(buf, '\0');
        /* rewrite from address, using rewriting rules */
        (void) expand(m->m_from, buf, &buf[sizeof buf - 1]);
        mvp = prescan(buf, '\0');
index 1b755ce..a6ef7d9 100644 (file)
@@ -7,7 +7,7 @@
 # include <syslog.h>
 # endif LOG
 
 # include <syslog.h>
 # endif LOG
 
-SCCSID(@(#)main.c      3.61            %G%);
+SCCSID(@(#)main.c      3.62            %G%);
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
@@ -325,6 +325,12 @@ main(argc, argv)
 # endif SMTP
                        }
                        break;
 # endif SMTP
                        }
                        break;
+
+# ifdef QUEUE
+                 case 'c':     /* don't connect to non-local mailers */
+                       NoConnect = TRUE;
+                       break;
+# endif QUEUE
                
                  case 's':     /* save From lines in headers */
                        SaveFrom++;
                
                  case 's':     /* save From lines in headers */
                        SaveFrom++;
index 91f55fb..a5cfa09 100644 (file)
@@ -1,6 +1,6 @@
 # include "sendmail.h"
 
 # include "sendmail.h"
 
-SCCSID(@(#)readcf.c    3.19            %G%);
+SCCSID(@(#)readcf.c    3.20            %G%);
 
 /*
 **  READCF -- read control file.
 
 /*
 **  READCF -- read control file.
@@ -418,6 +418,7 @@ struct optlist      OptList[] =
        'x',    M_FULLNAME,
        'A',    M_ARPAFMT,
        'U',    M_UGLYUUCP,
        'x',    M_FULLNAME,
        'A',    M_ARPAFMT,
        'U',    M_UGLYUUCP,
+       'e',    M_EXPENSIVE,
        '\0',   0
 };
 
        '\0',   0
 };
 
index 99dbbfd..04e277e 100644 (file)
@@ -7,7 +7,7 @@
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
-static char SmailSccsId[] =    "@(#)sendmail.h 3.58            %G%";
+static char SmailSccsId[] =    "@(#)sendmail.h 3.59            %G%";
 # endif lint
 # else  _DEFINE
 # define EXTERN extern
 # endif lint
 # else  _DEFINE
 # define EXTERN extern
@@ -129,6 +129,7 @@ typedef struct mailer       MAILER;
 # define M_HST_UPPER   000020000       /* preserve host case distinction */
 # define M_FULLNAME    000040000       /* want Full-Name field */
 # define M_UGLYUUCP    000100000       /* this wants an ugly UUCP from line */
 # define M_HST_UPPER   000020000       /* preserve host case distinction */
 # define M_FULLNAME    000040000       /* want Full-Name field */
 # define M_UGLYUUCP    000100000       /* this wants an ugly UUCP from line */
+# define M_EXPENSIVE   000200000       /* it costs to use this mailer.... */
 
 # define M_ARPAFMT     (M_NEEDDATE|M_NEEDFROM|M_MSGID)
 
 
 # define M_ARPAFMT     (M_NEEDDATE|M_NEEDFROM|M_MSGID)
 
@@ -334,6 +335,7 @@ EXTERN bool HoldErrs;       /* only output errors to transcript */
 EXTERN bool    ArpaMode;       /* set if running arpanet protocol */
 EXTERN bool    ForkOff;        /* fork after initial verification */
 EXTERN bool    OldStyle;       /* spaces (not commas) delimit addresses */
 EXTERN bool    ArpaMode;       /* set if running arpanet protocol */
 EXTERN bool    ForkOff;        /* fork after initial verification */
 EXTERN bool    OldStyle;       /* spaces (not commas) delimit addresses */
+EXTERN bool    NoConnect;      /* don't connect to non-local mailers */
 extern time_t  TimeOut;        /* time until timeout */
 EXTERN FILE    *InChannel;     /* input connection */
 EXTERN FILE    *OutChannel;    /* output connection */
 extern time_t  TimeOut;        /* time until timeout */
 EXTERN FILE    *InChannel;     /* input connection */
 EXTERN FILE    *OutChannel;    /* output connection */