split operation mode ("-bx" flag) and delivery mode ("d" option)
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Thu, 18 Nov 1982 01:37:39 +0000 (17:37 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Thu, 18 Nov 1982 01:37:39 +0000 (17:37 -0800)
so that operation mode can apply to SMTP/daemon connections also.

SCCS-mr: usr.sbin/sendmail/src/main.c 060
SCCS-mr: usr.sbin/sendmail/src/conf.c 060
SCCS-mr: usr.sbin/sendmail/src/deliver.c 060
SCCS-mr: usr.sbin/sendmail/src/collect.c 060
SCCS-mr: usr.sbin/sendmail/src/err.c 060
SCCS-mr: usr.sbin/sendmail/src/sendmail.h 060
SCCS-mr: usr.sbin/sendmail/src/parseaddr.c 060
SCCS-mr: usr.sbin/sendmail/src/savemail.c 060
SCCS-mr: usr.sbin/sendmail/src/version.c 060
SCCS-mr: usr.sbin/sendmail/src/queue.c 060
SCCS-mr: usr.sbin/sendmail/src/srvrsmtp.c 060
SCCS-mr: usr.sbin/sendmail/src/readcf.c 060
SCCS-mr: usr.sbin/sendmail/src/headers.c 060
SCCS-vsn: usr.sbin/sendmail/src/main.c 3.134
SCCS-vsn: usr.sbin/sendmail/src/conf.c 3.64
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 3.129
SCCS-vsn: usr.sbin/sendmail/src/collect.c 3.54
SCCS-vsn: usr.sbin/sendmail/src/err.c 3.33
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 3.99
SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 3.65
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 3.47
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.245
SCCS-vsn: usr.sbin/sendmail/src/queue.c 3.51
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 3.35
SCCS-vsn: usr.sbin/sendmail/src/readcf.c 3.44
SCCS-vsn: usr.sbin/sendmail/src/headers.c 3.37

13 files changed:
usr/src/usr.sbin/sendmail/src/collect.c
usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/err.c
usr/src/usr.sbin/sendmail/src/headers.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/parseaddr.c
usr/src/usr.sbin/sendmail/src/queue.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/srvrsmtp.c
usr/src/usr.sbin/sendmail/src/version.c

index 263cc84..eaa5ba1 100644 (file)
@@ -1,7 +1,7 @@
 # include <errno.h>
 # include "sendmail.h"
 
 # include <errno.h>
 # include "sendmail.h"
 
-SCCSID(@(#)collect.c   3.53            %G%);
+SCCSID(@(#)collect.c   3.54            %G%);
 
 /*
 **  COLLECT -- read & parse message header & make temp file.
 
 /*
 **  COLLECT -- read & parse message header & make temp file.
@@ -156,7 +156,7 @@ maketemp(from)
                        break;
 
                /* check for transparent dot */
                        break;
 
                /* check for transparent dot */
-               if (Smtp && *bp == '.')
+               if (OpMode == MD_SMTP && *bp == '.')
                        bp++;
 
 # ifndef NOTUNIX
                        bp++;
 
 # ifndef NOTUNIX
index c9fd9bb..433becb 100644 (file)
@@ -32,7 +32,7 @@
 
 
 
 
 
 
-SCCSID(@(#)conf.c      3.63            %G%);
+SCCSID(@(#)conf.c      3.64            %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.
@@ -262,7 +262,7 @@ getegid()
 
 getruid()
 {
 
 getruid()
 {
-       if (Mode == MD_DAEMON)
+       if (OpMode == MD_DAEMON)
                return (RealUid);
        else
                return (getuid());
                return (RealUid);
        else
                return (getuid());
@@ -275,7 +275,7 @@ getruid()
 
 getrgid()
 {
 
 getrgid()
 {
-       if (Mode == MD_DAEMON)
+       if (OpMode == MD_DAEMON)
                return (RealGid);
        else
                return (getgid());
                return (RealGid);
        else
                return (getgid());
index 4b5d2a5..af44609 100644 (file)
@@ -3,7 +3,7 @@
 # include "sendmail.h"
 # include <sys/stat.h>
 
 # include "sendmail.h"
 # include <sys/stat.h>
 
-SCCSID(@(#)deliver.c   3.128           %G%);
+SCCSID(@(#)deliver.c   3.129           %G%);
 
 /*
 **  DELIVER -- Deliver a message to a list of addresses.
 
 /*
 **  DELIVER -- Deliver a message to a list of addresses.
@@ -716,7 +716,7 @@ openmailer(m, pvp, ctladdr, clever, pmfile, prfile)
                        (void) dup(rpvect[1]);
                        (void) close(rpvect[1]);
                }
                        (void) dup(rpvect[1]);
                        (void) close(rpvect[1]);
                }
-               else if (Smtp || HoldErrs)
+               else if (OpMode == MD_SMTP || HoldErrs)
                {
                        (void) close(1);
                        (void) dup(fileno(Xscript));
                {
                        (void) close(1);
                        (void) dup(fileno(Xscript));
@@ -1419,7 +1419,7 @@ mailfile(filename, ctladdr)
 **
 **     Parameters:
 **             e -- the envelope to send.
 **
 **     Parameters:
 **             e -- the envelope to send.
-**             verifyonly -- if set, only give verification messages.
+**             mode -- the delivery mode to use.
 **
 **     Returns:
 **             none.
 **
 **     Returns:
 **             none.
@@ -1427,33 +1427,92 @@ mailfile(filename, ctladdr)
 **     Side Effects:
 **             Scans the send lists and sends everything it finds.
 **             Delivers any appropriate error messages.
 **     Side Effects:
 **             Scans the send lists and sends everything it finds.
 **             Delivers any appropriate error messages.
+**             If we are running in a non-interactive mode, takes the
+**                     appropriate action.
 */
 
 */
 
-sendall(e, verifyonly)
+sendall(e, mode)
        ENVELOPE *e;
        ENVELOPE *e;
-       bool verifyonly;
+       char mode;
 {
        register ADDRESS *q;
        bool oldverbose;
 {
        register ADDRESS *q;
        bool oldverbose;
+       int pid;
 
 # ifdef DEBUG
        if (tTd(13, 1))
        {
 
 # ifdef DEBUG
        if (tTd(13, 1))
        {
-               printf("\nSENDALL: verify %d, sendqueue:\n", verifyonly);
+               printf("\nSENDALL: mode %c, sendqueue:\n", mode);
                printaddr(e->e_sendqueue, TRUE);
        }
 # endif DEBUG
 
        /*
                printaddr(e->e_sendqueue, TRUE);
        }
 # endif DEBUG
 
        /*
-       **  Run through the list and send everything.
+       **  Do any preprocessing necessary for the mode we are running.
        */
 
        */
 
+# ifdef QUEUE
+       if (mode == SM_QUEUE)
+       {
+               register ADDRESS *q;
+
+               for (q = CurEnv->e_sendqueue; q != NULL; q = q->q_next)
+               {
+                       if (!bitset(QDONTSEND, q->q_flags))
+                       {
+                               CurEnv->e_to = q->q_paddr;
+                               message(Arpa_Info, "queued");
+                               if (LogLevel > 4)
+                                       logdelivery("queued");
+                       }
+                       CurEnv->e_to = NULL;
+               }
+       }
+       if (mode == SM_QUEUE || mode == SM_FORK ||
+           (mode != SM_VERIFY && SuperSafe))
+               queueup(CurEnv, TRUE);
+#endif QUEUE
+
        oldverbose = Verbose;
        oldverbose = Verbose;
-       if (verifyonly)
+       switch (mode)
+       {
+         case SM_VERIFY:
                Verbose = TRUE;
                Verbose = TRUE;
+               break;
+
+         case SM_QUEUE:
+               CurEnv->e_df = CurEnv->e_qf = NULL;
+               CurEnv->e_dontqueue = TRUE;
+               finis();
+               return;
+
+         case SM_FORK:
+               pid = fork();
+               if (pid < 0)
+               {
+                       mode = SM_DELIVER;
+                       break;
+               }
+               else if (pid > 0)
+                       return;
+
+               /* double fork to avoid zombies */
+               if (fork() > 0)
+                       exit(EX_OK);
+
+               /* now arrange to run the queue */
+               HoldErrs = MailBack = TRUE;
+               Verbose = FALSE;
+               break;
+       }
+
+       /*
+       **  Run through the list and send everything.
+       */
+
        for (q = e->e_sendqueue; q != NULL; q = q->q_next)
        {
        for (q = e->e_sendqueue; q != NULL; q = q->q_next)
        {
-               if (verifyonly)
+               if (mode == SM_VERIFY)
                {
                        CurEnv->e_to = q->q_paddr;
                        if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
                {
                        CurEnv->e_to = q->q_paddr;
                        if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
@@ -1468,7 +1527,7 @@ sendall(e, verifyonly)
        **  Now run through and check for errors.
        */
 
        **  Now run through and check for errors.
        */
 
-       if (verifyonly)
+       if (mode == SM_VERIFY)
                return;
 
        for (q = e->e_sendqueue; q != NULL; q = q->q_next)
                return;
 
        for (q = e->e_sendqueue; q != NULL; q = q->q_next)
@@ -1530,6 +1589,9 @@ sendall(e, verifyonly)
                if (qq == NULL && bitset(QBADADDR, q->q_flags))
                        sendto(e->e_from.q_paddr, qq, &e->e_errorqueue);
        }
                if (qq == NULL && bitset(QBADADDR, q->q_flags))
                        sendto(e->e_from.q_paddr, qq, &e->e_errorqueue);
        }
+
+       if (mode == SM_FORK)
+               finis();
 }
 \f/*
 **  CHECKERRORS -- check a queue of addresses and process errors.
 }
 \f/*
 **  CHECKERRORS -- check a queue of addresses and process errors.
index 565bcad..8074448 100644 (file)
@@ -1,6 +1,6 @@
 # include "sendmail.h"
 
 # include "sendmail.h"
 
-SCCSID(@(#)err.c       3.32            %G%);
+SCCSID(@(#)err.c       3.33            %G%);
 
 /*
 **  SYSERR -- Print error message.
 
 /*
 **  SYSERR -- Print error message.
@@ -168,13 +168,13 @@ putmsg(msg, holdmsg)
 {
        /* output to transcript */
        if (Xscript != OutChannel)
 {
        /* output to transcript */
        if (Xscript != OutChannel)
-               fprintf(Xscript, "%s\n", Smtp ? msg : &msg[4]);
+               fprintf(Xscript, "%s\n", OpMode == MD_SMTP ? msg : &msg[4]);
 
        /* output to channel if appropriate */
        if (!holdmsg && (Verbose || msg[0] != '0'))
        {
                (void) fflush(stdout);
 
        /* output to channel if appropriate */
        if (!holdmsg && (Verbose || msg[0] != '0'))
        {
                (void) fflush(stdout);
-               if (ArpaMode)
+               if (OpMode == MD_SMTP || OpMode == MD_ARPAFTP)
                        fprintf(OutChannel, "%s\r\n", msg);
                else
                        fprintf(OutChannel, "%s\n", &msg[4]);
                        fprintf(OutChannel, "%s\r\n", msg);
                else
                        fprintf(OutChannel, "%s\n", &msg[4]);
index c98251d..d88d00c 100644 (file)
@@ -1,7 +1,7 @@
 # include <errno.h>
 # include "sendmail.h"
 
 # include <errno.h>
 # include "sendmail.h"
 
-SCCSID(@(#)headers.c   3.36            %G%);
+SCCSID(@(#)headers.c   3.37            %G%);
 
 /*
 **  CHOMPHEADER -- process and save a header line.
 
 /*
 **  CHOMPHEADER -- process and save a header line.
@@ -389,7 +389,7 @@ eatheader()
                sendto(p, (ADDRESS *) NULL, &CurEnv->e_errorqueue);
 
        /* from person */
                sendto(p, (ADDRESS *) NULL, &CurEnv->e_errorqueue);
 
        /* from person */
-       if (ArpaMode)
+       if (OpMode == MD_ARPAFTP)
        {
                register struct hdrinfo *hi = HdrInfo;
 
        {
                register struct hdrinfo *hi = HdrInfo;
 
index b7a9ff5..10a6f46 100644 (file)
@@ -6,7 +6,7 @@
 # include "sendmail.h"
 # include <sys/stat.h>
 
 # include "sendmail.h"
 # include <sys/stat.h>
 
-SCCSID(@(#)main.c      3.133           %G%);
+SCCSID(@(#)main.c      3.134           %G%);
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
@@ -166,7 +166,7 @@ main(argc, argv)
                (void) signal(SIGHUP, intsig);
        (void) signal(SIGTERM, intsig);
        OldUmask = umask(0);
                (void) signal(SIGHUP, intsig);
        (void) signal(SIGTERM, intsig);
        OldUmask = umask(0);
-       Mode = MD_DEFAULT;
+       OpMode = MD_DELIVER;
        MotherPid = getpid();
 # ifndef V6
        FullName = getenv("NAME");
        MotherPid = getpid();
 # ifndef V6
        FullName = getenv("NAME");
@@ -197,23 +197,39 @@ main(argc, argv)
        if (p++ == NULL)
                p = *av;
        if (strcmp(p, "newaliases") == 0)
        if (p++ == NULL)
                p = *av;
        if (strcmp(p, "newaliases") == 0)
-               setoption('b', "i", FALSE, TRUE);
+               OpMode = MD_INITALIAS;
        else if (strcmp(p, "mailq") == 0)
        else if (strcmp(p, "mailq") == 0)
-               setoption('b', "p", FALSE, TRUE);
+               OpMode = MD_PRINT;
        while (--ac > 0 && (p = *++av)[0] == '-')
        {
                switch (p[1])
                {
        while (--ac > 0 && (p = *++av)[0] == '-')
        {
                switch (p[1])
                {
-                 case 'a':     /* arpanet format */
-                       ArpaMode = TRUE;
-                       if (p[2] == 's')
+                 case 'b':     /* operations mode */
+                       switch (p[2])
                        {
                        {
-                               /* running smtp */
-# ifdef SMTP
-                               Smtp = TRUE;
-# else SMTP
+                         case MD_DAEMON:
+# ifndef DAEMON
+                               syserr("Daemon mode not implemented");
+                               break;
+# endif DAEMON
+                         case MD_SMTP:
+# ifndef SMTP
                                syserr("I don't speak SMTP");
                                syserr("I don't speak SMTP");
+                               break;
 # endif SMTP
 # endif SMTP
+                         case MD_ARPAFTP:
+                         case MD_DELIVER:
+                         case MD_VERIFY:
+                         case MD_TEST:
+                         case MD_INITALIAS:
+                         case MD_PRINT:
+                         case MD_FREEZE:
+                               OpMode = p[2];
+                               break;
+
+                         default:
+                               syserr("Invalid operation mode %c", p[2]);
+                               break;
                        }
                        break;
 
                        }
                        break;
 
@@ -309,7 +325,6 @@ main(argc, argv)
                        break;
 
                        /* compatibility flags */
                        break;
 
                        /* compatibility flags */
-                 case 'b':     /* operations mode */
                  case 'c':     /* connect to non-local mailers */
                  case 'e':     /* error message disposition */
                  case 'i':     /* don't let dot stop me */
                  case 'c':     /* connect to non-local mailers */
                  case 'e':     /* error message disposition */
                  case 'i':     /* don't let dot stop me */
@@ -325,7 +340,7 @@ main(argc, argv)
 
 # ifdef DBM
                  case 'I':     /* initialize alias DBM file */
 
 # ifdef DBM
                  case 'I':     /* initialize alias DBM file */
-                       setoption('b', "i", FALSE, TRUE);
+                       OpMode = MD_INITALIAS;
                        break;
 # endif DBM
                }
                        break;
 # endif DBM
                }
@@ -339,12 +354,12 @@ main(argc, argv)
 
        if (pass <= 1)
        {
 
        if (pass <= 1)
        {
-               if (!safecf || Mode == MD_FREEZE || !thaw())
+               if (!safecf || OpMode == MD_FREEZE || !thaw())
                        readcf(ConfFile, safecf);
                else
                        goto crackargs;
        }
                        readcf(ConfFile, safecf);
                else
                        goto crackargs;
        }
-       switch (Mode)
+       switch (OpMode)
        {
          case MD_FREEZE:
                freeze();
        {
          case MD_FREEZE:
                freeze();
@@ -361,7 +376,13 @@ main(argc, argv)
 
        /* do heuristic mode adjustment */
        if (Verbose)
 
        /* do heuristic mode adjustment */
        if (Verbose)
-               setoption('b', "a", TRUE, FALSE);
+       {
+               /* turn off noconnect option */
+               setoption('c', "F", TRUE, FALSE);
+
+               /* turn on interactive delivery */
+               setoption('d', "", TRUE, FALSE);
+       }
 
        /* our name for SMTP codes */
        expand("$j", jbuf, &jbuf[sizeof jbuf - 1], CurEnv);
 
        /* our name for SMTP codes */
        expand("$j", jbuf, &jbuf[sizeof jbuf - 1], CurEnv);
@@ -390,9 +411,9 @@ main(argc, argv)
        **  Initialize aliases.
        */
 
        **  Initialize aliases.
        */
 
-       initaliases(AliasFile, Mode == MD_INITALIAS);
+       initaliases(AliasFile, OpMode == MD_INITALIAS);
 # ifdef DBM
 # ifdef DBM
-       if (Mode == MD_INITALIAS)
+       if (OpMode == MD_INITALIAS)
                exit(EX_OK);
 # endif DBM
 
                exit(EX_OK);
 # endif DBM
 
@@ -424,7 +445,7 @@ main(argc, argv)
        **  If test mode, read addresses from stdin and process.
        */
 
        **  If test mode, read addresses from stdin and process.
        */
 
-       if (Mode == MD_TEST)
+       if (OpMode == MD_TEST)
        {
                char buf[MAXLINE];
 
        {
                char buf[MAXLINE];
 
@@ -476,7 +497,7 @@ main(argc, argv)
        **              during startup.
        */
 
        **              during startup.
        */
 
-       if (Mode == MD_DAEMON || QueueIntvl != 0)
+       if (OpMode == MD_DAEMON || QueueIntvl != 0)
        {
                if (!tTd(0, 1))
                {
        {
                if (!tTd(0, 1))
                {
@@ -508,7 +529,7 @@ main(argc, argv)
                if (queuemode)
                {
                        runqueue(TRUE);
                if (queuemode)
                {
                        runqueue(TRUE);
-                       if (Mode != MD_DAEMON)
+                       if (OpMode != MD_DAEMON)
                                for (;;)
                                        pause();
                }
                                for (;;)
                                        pause();
                }
@@ -517,6 +538,7 @@ main(argc, argv)
                getrequests();
 
                /* at this point we are in a child: reset state */
                getrequests();
 
                /* at this point we are in a child: reset state */
+               OpMode = MD_SMTP;
                dropenvelope(CurEnv);
                CurEnv->e_id = CurEnv->e_qf = CurEnv->e_df = NULL;
                FatalErrors = FALSE;
                dropenvelope(CurEnv);
                CurEnv->e_id = CurEnv->e_qf = CurEnv->e_df = NULL;
                FatalErrors = FALSE;
@@ -528,7 +550,7 @@ main(argc, argv)
        **  If collecting stuff from the queue, go start doing that.
        */
 
        **  If collecting stuff from the queue, go start doing that.
        */
 
-       if (queuemode && Mode != MD_DAEMON)
+       if (queuemode && OpMode != MD_DAEMON)
        {
                runqueue(FALSE);
                finis();
        {
                runqueue(FALSE);
                finis();
@@ -544,7 +566,7 @@ main(argc, argv)
        **  commands.  This will never return.
        */
 
        **  commands.  This will never return.
        */
 
-       if (Smtp)
+       if (OpMode == MD_SMTP)
                smtp();
 # endif SMTP
 
                smtp();
 # endif SMTP
 
@@ -554,11 +576,13 @@ main(argc, argv)
 
        setsender(from);
 
 
        setsender(from);
 
-       if (Mode != MD_DAEMON && ac <= 0 && !GrabTo)
+       if (OpMode != MD_DAEMON && ac <= 0 && !GrabTo)
        {
                usrerr("Usage: /etc/sendmail [flags] addr...");
                finis();
        }
        {
                usrerr("Usage: /etc/sendmail [flags] addr...");
                finis();
        }
+       if (OpMode == MD_VERIFY)
+               SendMode = SM_VERIFY;
 
        /*
        **  Process Hop count.
 
        /*
        **  Process Hop count.
@@ -591,63 +615,10 @@ main(argc, argv)
 
        DontSend = FALSE;
        CurEnv->e_to = NULL;
 
        DontSend = FALSE;
        CurEnv->e_to = NULL;
-       if (Mode != MD_VERIFY || GrabTo)
+       if (OpMode != MD_VERIFY || GrabTo)
                collect(FALSE);
        errno = 0;
 
                collect(FALSE);
        errno = 0;
 
-       /*
-       **  If we don't want to wait around for actual delivery, this
-       **  is a good time to fork off.
-       **      We have examined what we can without doing actual
-       **              delivery, so we will inform our caller of
-       **              whatever we can now.
-       **      Since the parent process will go away immediately,
-       **              the child will be caught by init.
-       **      If the fork fails, we will just continue in the
-       **              parent; this is perfectly safe, albeit
-       **              slower than it must be.
-       */
-
-# ifdef QUEUE
-       if (Mode == MD_QUEUE)
-       {
-               register ADDRESS *q;
-
-               for (q = CurEnv->e_sendqueue; q != NULL; q = q->q_next)
-               {
-                       if (!bitset(QDONTSEND, q->q_flags))
-                       {
-                               CurEnv->e_to = q->q_paddr;
-                               message(Arpa_Info, "queued");
-                               if (LogLevel > 4)
-                                       logdelivery("queued");
-                       }
-                       CurEnv->e_to = NULL;
-               }
-       }
-       if (Mode == MD_QUEUE || Mode == MD_FORK ||
-           (Mode != MD_VERIFY && SuperSafe))
-               queueup(CurEnv, TRUE);
-
-       if (Mode == MD_FORK)
-       {
-               if (fork() > 0)
-               {
-                       /* parent -- quit */
-                       exit(ExitStat);
-               }
-# ifdef LOG
-               if (LogLevel > 11)
-                       syslog(LOG_DEBUG, "background delivery, pid=%d", getpid());
-# endif LOG
-       }
-       else if (Mode == MD_QUEUE)
-       {
-               CurEnv->e_df = CurEnv->e_qf = NULL;
-               CurEnv->e_dontqueue = TRUE;
-               finis();
-       }
-
        initsys();
 
        /* collect statistics */
        initsys();
 
        /* collect statistics */
@@ -674,14 +645,14 @@ main(argc, argv)
        **      If verifying, just ack.
        */
 
        **      If verifying, just ack.
        */
 
-       sendall(CurEnv, Mode == MD_VERIFY);
+       sendall(CurEnv, SendMode);
 
        /*
        ** All done.
        */
 
        CurEnv->e_to = NULL;
 
        /*
        ** All done.
        */
 
        CurEnv->e_to = NULL;
-       if (Mode != MD_VERIFY)
+       if (OpMode != MD_VERIFY)
                poststats(StatFile);
        finis();
 }
                poststats(StatFile);
        finis();
 }
@@ -977,7 +948,7 @@ setsender(from)
        **      Getlogin can return errno != 0 on non-errors.
        */
 
        **      Getlogin can return errno != 0 on non-errors.
        */
 
-       if (!Smtp && !QueueRun)
+       if (OpMode != MD_SMTP && !QueueRun)
        {
                errno = 0;
                p = getlogin();
        {
                errno = 0;
                p = getlogin();
@@ -996,7 +967,7 @@ setsender(from)
                pw = getpwnam(p);
                if (pw == NULL)
                {
                pw = getpwnam(p);
                if (pw == NULL)
                {
-                       if (!Smtp && !QueueRun)
+                       if (OpMode != MD_SMTP && !QueueRun)
                                syserr("Who are you? (name=%s)", p);
                        p = NULL;
                }
                                syserr("Who are you? (name=%s)", p);
                        p = NULL;
                }
@@ -1094,7 +1065,7 @@ initsys()
        **      tucked away in the transcript).
        */
 
        **      tucked away in the transcript).
        */
 
-       if (Mode == MD_DAEMON && QueueRun)
+       if (OpMode == MD_DAEMON && QueueRun)
                OutChannel = Xscript;
 
        /*
                OutChannel = Xscript;
 
        /*
index d288e56..cc717ad 100644 (file)
@@ -1,6 +1,6 @@
 # include "sendmail.h"
 
 # include "sendmail.h"
 
-SCCSID(@(#)parseaddr.c 3.64            %G%);
+SCCSID(@(#)parseaddr.c 3.65            %G%);
 
 /*
 **  PARSE -- Parse an address
 
 /*
 **  PARSE -- Parse an address
@@ -470,7 +470,7 @@ rewrite(pvp, ruleset)
        char *npvp[MAXATOM+1];          /* temporary space for rebuild */
        extern bool sameword();
 
        char *npvp[MAXATOM+1];          /* temporary space for rebuild */
        extern bool sameword();
 
-       if (Mode == MD_TEST || tTd(21, 2))
+       if (OpMode == MD_TEST || tTd(21, 2))
        {
                printf("rewrite: ruleset %2d   input:", ruleset);
                printav(pvp);
        {
                printf("rewrite: ruleset %2d   input:", ruleset);
                printav(pvp);
@@ -704,7 +704,7 @@ rewrite(pvp, ruleset)
                }
        }
 
                }
        }
 
-       if (Mode == MD_TEST || tTd(21, 2))
+       if (OpMode == MD_TEST || tTd(21, 2))
        {
                printf("rewrite: ruleset %2d returns:", ruleset);
                printav(pvp);
        {
                printf("rewrite: ruleset %2d returns:", ruleset);
                printav(pvp);
index 5621093..be9c3a6 100644 (file)
@@ -5,10 +5,10 @@
 # include <errno.h>
 
 # ifndef QUEUE
 # include <errno.h>
 
 # ifndef QUEUE
-SCCSID(@(#)queue.c     3.50            %G%     (no queueing));
+SCCSID(@(#)queue.c     3.51            %G%     (no queueing));
 # else QUEUE
 
 # else QUEUE
 
-SCCSID(@(#)queue.c     3.50            %G%);
+SCCSID(@(#)queue.c     3.51            %G%);
 
 /*
 **  QUEUEUP -- queue a message up for future transmission.
 
 /*
 **  QUEUEUP -- queue a message up for future transmission.
@@ -485,7 +485,7 @@ dowork(w)
 
                /* do the delivery */
                if (!FatalErrors)
 
                /* do the delivery */
                if (!FatalErrors)
-                       sendall(CurEnv, FALSE);
+                       sendall(CurEnv, SM_DELIVER);
 
                /* if still not sent, perhaps we should time out.... */
 # ifdef DEBUG
 
                /* if still not sent, perhaps we should time out.... */
 # ifdef DEBUG
index 9bbb472..4988e50 100644 (file)
@@ -1,6 +1,6 @@
 # include "sendmail.h"
 
 # include "sendmail.h"
 
-SCCSID(@(#)readcf.c    3.43            %G%);
+SCCSID(@(#)readcf.c    3.44            %G%);
 
 /*
 **  READCF -- read control file.
 
 /*
 **  READCF -- read control file.
@@ -649,42 +649,29 @@ setoption(opt, val, safe, sticky)
                SafeAlias = bval;
                break;
 
                SafeAlias = bval;
                break;
 
-         case 'b':             /* operations mode */
-               Mode = *val;
-               switch (Mode)
+         case 'c':             /* don't connect to "expensive" mailers */
+               NoConnect = bval;
+               break;
+
+         case 'd':             /* delivery mode */
+               switch (*val)
                {
                {
-                 case MD_DAEMON:       /* run as a daemon */
-#ifdef DAEMON
-                       ArpaMode = Smtp = TRUE;
-#else DAEMON
-                       syserr("Daemon mode not implemented");
-#endif DAEMON
+                 case '\0':
+                       SendMode = SM_DELIVER;
                        break;
 
                        break;
 
-                 case '\0':    /* default: do full delivery */
-                       Mode = MD_DEFAULT;
-                       /* fall through....... */
-
-                 case MD_DELIVER:      /* do everything (default) */
-                 case MD_FORK:         /* fork after verification */
-                 case MD_QUEUE:        /* queue only */
-                 case MD_VERIFY:       /* verify only */
-                 case MD_TEST:         /* test addresses */
-                 case MD_PRINT:        /* print queue contents */
-                 case MD_INITALIAS:    /* initialize alias database */
-                 case MD_FREEZE:       /* freeze config file */
+                 case SM_DELIVER:      /* do everything */
+                 case SM_FORK:         /* fork after verification */
+                 case SM_QUEUE:        /* queue only */
+                       SendMode = *val;
                        break;
 
                  default:
                        break;
 
                  default:
-                       syserr("Unknown operation mode -b%c", Mode);
+                       syserr("Unknown delivery mode %c", *val);
                        exit(EX_USAGE);
                }
                break;
 
                        exit(EX_USAGE);
                }
                break;
 
-         case 'c':             /* don't connect to "expensive" mailers */
-               NoConnect = bval;
-               break;
-
          case 'D':             /* rebuild alias database as needed */
                AutoRebuild = bval;
                break;
          case 'D':             /* rebuild alias database as needed */
                AutoRebuild = bval;
                break;
@@ -796,8 +783,6 @@ setoption(opt, val, safe, sticky)
 
          case 'v':             /* run in verbose mode */
                Verbose = bval;
 
          case 'v':             /* run in verbose mode */
                Verbose = bval;
-               if (Verbose)
-                       NoConnect = FALSE;
                break;
 
 # ifdef DEBUG
                break;
 
 # ifdef DEBUG
index a7876ad..ed491dc 100644 (file)
@@ -1,7 +1,7 @@
 # include <pwd.h>
 # include "sendmail.h"
 
 # include <pwd.h>
 # include "sendmail.h"
 
-SCCSID(@(#)savemail.c  3.46            %G%);
+SCCSID(@(#)savemail.c  3.47            %G%);
 
 /*
 **  SAVEMAIL -- Save mail on error
 
 /*
 **  SAVEMAIL -- Save mail on error
@@ -144,7 +144,7 @@ savemail()
        **      expected to handle that.
        */
 
        **      expected to handle that.
        */
 
-       if (ArpaMode)
+       if (OpMode == MD_ARPAFTP || OpMode == MD_SMTP)
                return;
        p = NULL;
        if (CurEnv->e_returnto->q_mailer == LocalMailer)
                return;
        p = NULL;
        if (CurEnv->e_returnto->q_mailer == LocalMailer)
@@ -262,7 +262,7 @@ returntosender(msg, returnto, sendbody)
        define('x', "Mail Delivery Subsystem");
 
        /* actually deliver the error message */
        define('x', "Mail Delivery Subsystem");
 
        /* actually deliver the error message */
-       sendall(ee, FALSE);
+       sendall(ee, SendMode);
 
        /* do any closing error processing */
        checkerrors(ee);
 
        /* do any closing error processing */
        checkerrors(ee);
index 7aa8d8e..6635d03 100644 (file)
@@ -7,7 +7,7 @@
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
-static char SmailSccsId[] =    "@(#)sendmail.h 3.98            %G%";
+static char SmailSccsId[] =    "@(#)sendmail.h 3.99            %G%";
 # endif lint
 # else  _DEFINE
 # define EXTERN extern
 # endif lint
 # else  _DEFINE
 # define EXTERN extern
@@ -352,16 +352,26 @@ struct statistics
 EXTERN struct statistics       Stat;
 extern long                    kbytes();       /* for _bf, _bt */
 \f/*
 EXTERN struct statistics       Stat;
 extern long                    kbytes();       /* for _bf, _bt */
 \f/*
-**  Operation modes
-**     The default operation mode can be safely changed (except
-**     that the default cannot be MD_DAEMON).
+**  Operation and send modes
+**
+**     The operation mode describes the basic operation of sendmail.
+**     This can be set from the command line, and is "send mail" by
+**     default.
+**
+**     The send mode tells how to send mail.  It can be set in the
+**     configuration file.  It's setting determines how quickly the
+**     mail will be delivered versus the load on your system.  If the
+**     -v (verbose) flag is given, it will be forced to SM_DELIVER
+**     mode.
+**
+**     The default send mode can be safely changed.
 */
 
 */
 
-EXTERN char    Mode;           /* operation mode, see below */
+EXTERN char    OpMode;         /* operation mode, see below */
 
 
-#define MD_DELIVER     'a'             /* collect and deliver */
-#define MD_FORK                'f'             /* verify & fork before delivery */
-#define MD_QUEUE       'q'             /* collect & queue, don't deliver */
+#define MD_DELIVER     'm'             /* be a mail sender */
+#define MD_ARPAFTP     'a'             /* old-style arpanet protocols */
+#define MD_SMTP                's'             /* run SMTP on standard input */
 #define MD_DAEMON      'd'             /* run as a daemon */
 #define MD_VERIFY      'v'             /* verify: don't collect or deliver */
 #define MD_TEST                't'             /* test mode: resolve addrs only */
 #define MD_DAEMON      'd'             /* run as a daemon */
 #define MD_VERIFY      'v'             /* verify: don't collect or deliver */
 #define MD_TEST                't'             /* test mode: resolve addrs only */
@@ -369,7 +379,14 @@ EXTERN char        Mode;           /* operation mode, see below */
 #define MD_PRINT       'p'             /* print the queue */
 #define MD_FREEZE      'z'             /* freeze the configuration file */
 
 #define MD_PRINT       'p'             /* print the queue */
 #define MD_FREEZE      'z'             /* freeze the configuration file */
 
-#define MD_DEFAULT     MD_DELIVER      /* default operation mode */
+
+EXTERN char    SendMode;       /* send mode, see below */
+
+#define SM_DELIVER     'i'             /* interactive delivery */
+#define SM_QUICKD      'j'             /* deliver w/o queueing */
+#define SM_FORK                'b'             /* deliver in background */
+#define SM_QUEUE       'q'             /* queue, don't deliver */
+#define SM_VERIFY      'v'             /* verify only (used internally) */
 \f/*
 **  Global variables.
 */
 \f/*
 **  Global variables.
 */
@@ -387,11 +404,9 @@ EXTERN bool        Verbose;        /* set if blow-by-blow desired */
 EXTERN bool    GrabTo;         /* if set, get recipients from msg */
 EXTERN bool    DontSend;       /* mark recipients as QDONTSEND */
 EXTERN bool    NoReturn;       /* don't return letter to sender */
 EXTERN bool    GrabTo;         /* if set, get recipients from msg */
 EXTERN bool    DontSend;       /* mark recipients as QDONTSEND */
 EXTERN bool    NoReturn;       /* don't return letter to sender */
-EXTERN bool    Smtp;           /* using SMTP over connection */
 EXTERN bool    SuprErrs;       /* set if we are suppressing errors */
 EXTERN bool    QueueRun;       /* currently running message from the queue */
 EXTERN bool    HoldErrs;       /* only output errors to transcript */
 EXTERN bool    SuprErrs;       /* set if we are suppressing errors */
 EXTERN bool    QueueRun;       /* currently running message from the queue */
 EXTERN bool    HoldErrs;       /* only output errors to transcript */
-EXTERN bool    ArpaMode;       /* set if running arpanet protocol */
 EXTERN bool    NoConnect;      /* don't connect to non-local mailers */
 EXTERN bool    FatalErrors;    /* set if fatal errors during processing */
 EXTERN bool    SuperSafe;      /* be extra careful, even if expensive */
 EXTERN bool    NoConnect;      /* don't connect to non-local mailers */
 EXTERN bool    FatalErrors;    /* set if fatal errors during processing */
 EXTERN bool    SuperSafe;      /* be extra careful, even if expensive */
index 8ac3f5d..928a7e8 100644 (file)
@@ -1,10 +1,10 @@
 # include "sendmail.h"
 
 # ifndef SMTP
 # include "sendmail.h"
 
 # ifndef SMTP
-SCCSID(@(#)srvrsmtp.c  3.34            %G%     (no SMTP));
+SCCSID(@(#)srvrsmtp.c  3.35            %G%     (no SMTP));
 # else SMTP
 
 # else SMTP
 
-SCCSID(@(#)srvrsmtp.c  3.34            %G%);
+SCCSID(@(#)srvrsmtp.c  3.35            %G%);
 
 /*
 **  SMTP -- run the SMTP protocol.
 
 /*
 **  SMTP -- run the SMTP protocol.
@@ -223,14 +223,14 @@ smtp()
                        FatalErrors = FALSE;
 
                        /* send to all recipients */
                        FatalErrors = FALSE;
 
                        /* send to all recipients */
-                       sendall(CurEnv, FALSE);
+                       sendall(CurEnv, SendMode);
                        CurEnv->e_to = NULL;
 
                        /* issue success if appropriate and reset */
                        if (Errors == 0 || HoldErrs)
                        {
                                HoldErrs = FALSE;
                        CurEnv->e_to = NULL;
 
                        /* issue success if appropriate and reset */
                        if (Errors == 0 || HoldErrs)
                        {
                                HoldErrs = FALSE;
-                               message("250", "Sent");
+                               message("250", "Ok");
                        }
                        else
                                FatalErrors = FALSE;
                        }
                        else
                                FatalErrors = FALSE;
index 87888e6..8e39c9f 100644 (file)
@@ -1,5 +1,5 @@
 # ifndef lint
 # ifndef lint
-static char    SccsId[] = "@(#)SendMail version 3.244 of %G%";
+static char    SccsId[] = "@(#)SendMail version 3.245 of %G%";
 # endif lint
 
 # endif lint
 
-char   Version[] = "3.244 [%G%]";
+char   Version[] = "3.245 [%G%]";