add "envelopes" to contain the basic information needed as control
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 22 May 1982 16:39:09 +0000 (08:39 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 22 May 1982 16:39:09 +0000 (08:39 -0800)
info for each message.  currently there is only one envelope -- this
being the obvious stupid conversion.  later there will be separate
envelopes for error messages, return receipts, etc.

SCCS-vsn: usr.sbin/sendmail/src/alias.c 3.31
SCCS-vsn: usr.sbin/sendmail/src/conf.c 3.46
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 3.79
SCCS-vsn: usr.sbin/sendmail/src/collect.c 3.37
SCCS-vsn: usr.sbin/sendmail/src/err.c 3.20
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 3.67
SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 3.41
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 3.28
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.104
SCCS-vsn: usr.sbin/sendmail/src/main.c 3.74
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 3.35
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 3.15
SCCS-vsn: usr.sbin/sendmail/src/headers.c 3.18
SCCS-vsn: usr.sbin/sendmail/src/queue.c 3.13

14 files changed:
usr/src/usr.sbin/sendmail/src/alias.c
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/recipient.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 57a0c89..3a89367 100644 (file)
@@ -4,9 +4,9 @@
 # include "sendmail.h"
 
 # ifdef DBM
 # include "sendmail.h"
 
 # ifdef DBM
-SCCSID(@(#)alias.c     3.30            %G%     (with DBM));
+SCCSID(@(#)alias.c     3.31            %G%     (with DBM));
 # else DBM
 # else DBM
-SCCSID(@(#)alias.c     3.30            %G%     (without DBM));
+SCCSID(@(#)alias.c     3.31            %G%     (without DBM));
 # endif DBM
 
 /*
 # endif DBM
 
 /*
@@ -77,7 +77,7 @@ alias(a, sendq)
        if (bitset(QDONTSEND, a->q_flags))
                return;
 
        if (bitset(QDONTSEND, a->q_flags))
                return;
 
-       To = a->q_paddr;
+       CurEnv->e_to = a->q_paddr;
 
        /*
        **  Look up this name
 
        /*
        **  Look up this name
@@ -426,7 +426,7 @@ readaliases(aliasfile, init)
                        longest = rhssize;
        }
        (void) fclose(af);
                        longest = rhssize;
        }
        (void) fclose(af);
-       To = NULL;
+       CurEnv->e_to = NULL;
        if (Verbose)
                message(Arpa_Info, "%d aliases, longest %d bytes, %d bytes total",
                        naliases, longest, bytes);
        if (Verbose)
                message(Arpa_Info, "%d aliases, longest %d bytes, %d bytes total",
                        naliases, longest, bytes);
index cc4e3a7..b3b0049 100644 (file)
@@ -1,7 +1,7 @@
 # include <errno.h>
 # include "sendmail.h"
 
 # include <errno.h>
 # include "sendmail.h"
 
-SCCSID(@(#)collect.c   3.36            %G%);
+SCCSID(@(#)collect.c   3.37            %G%);
 
 /*
 **  COLLECT -- read & parse message header & make temp file.
 
 /*
 **  COLLECT -- read & parse message header & make temp file.
@@ -33,8 +33,6 @@ SCCSID(@(#)collect.c  3.36            %G%);
 **             The from person may be set.
 */
 
 **             The from person may be set.
 */
 
-long   MsgSize;                /* size of message in bytes */
-
 maketemp(from)
        char *from;
 {
 maketemp(from)
        char *from;
 {
@@ -132,7 +130,7 @@ maketemp(from)
                if (!feof(InChannel))
                        (void) ungetc(c, InChannel);
 
                if (!feof(InChannel))
                        (void) ungetc(c, InChannel);
 
-               MsgSize += strlen(buf);
+               CurEnv->e_msgsize += strlen(buf);
 
                /*
                **  Snarf header away.
 
                /*
                **  Snarf header away.
@@ -178,7 +176,7 @@ maketemp(from)
                if (strncmp(bp, "From ", 5) == 0)
                {
                        fputs(">", tf);
                if (strncmp(bp, "From ", 5) == 0)
                {
                        fputs(">", tf);
-                       MsgSize++;
+                       CurEnv->e_msgsize++;
                }
 # endif NOTUNIX
 
                }
 # endif NOTUNIX
 
@@ -188,7 +186,7 @@ maketemp(from)
                */
 
                i = strlen(bp);
                */
 
                i = strlen(bp);
-               MsgSize += i;
+               CurEnv->e_msgsize += i;
                fputs(bp, tf);
                if (bp[i - 1] != '\n')
                        fputs("\n", tf);
                fputs(bp, tf);
                if (bp[i - 1] != '\n')
                        fputs("\n", tf);
@@ -216,10 +214,10 @@ maketemp(from)
        if (!QueueRun)
        {
                /* adjust total priority by message priority */
        if (!QueueRun)
        {
                /* adjust total priority by message priority */
-               MsgPriority = MsgSize;
+               CurEnv->e_msgpriority = CurEnv->e_msgsize;
                p = hvalue("priority");
                if (p != NULL)
                p = hvalue("priority");
                if (p != NULL)
-                       MsgPriority -= priencode(p) * WKPRIFACT;
+                       CurEnv->e_msgpriority -= priencode(p) * WKPRIFACT;
        }
 
        /* special handling */
        }
 
        /* special handling */
@@ -230,7 +228,7 @@ maketemp(from)
        /* from person */
        xfrom = hvalue("sender");
        if (xfrom == NULL)
        /* from person */
        xfrom = hvalue("sender");
        if (xfrom == NULL)
-               xfrom = OrigFrom;
+               xfrom = CurEnv->e_origfrom;
        if (ArpaMode)
                setfrom(xfrom, (char *) NULL);
 
        if (ArpaMode)
                setfrom(xfrom, (char *) NULL);
 
@@ -254,7 +252,7 @@ maketemp(from)
 
                p = hvalue("original-from");
                if (p == NULL)
 
                p = hvalue("original-from");
                if (p == NULL)
-                       p = OrigFrom;
+                       p = CurEnv->e_origfrom;
                p = getxpart(p);
                if (p != NULL)
                        define('x', newstr(p));
                p = getxpart(p);
                if (p != NULL)
                        define('x', newstr(p));
@@ -282,7 +280,7 @@ maketemp(from)
                extern char *capitalize();
 
                printf("----- collected header -----\n");
                extern char *capitalize();
 
                printf("----- collected header -----\n");
-               for (h = Header; h != NULL; h = h->h_link)
+               for (h = CurEnv->e_header; h != NULL; h = h->h_link)
                        printf("%s: %s\n", capitalize(h->h_field), h->h_value);
                printf("----------------------------\n");
        }
                        printf("%s: %s\n", capitalize(h->h_field), h->h_value);
                printf("----------------------------\n");
        }
@@ -477,7 +475,7 @@ spechandling(p)
                        break;
 
                  case HAN_RRECEIPT:    /* give return receipt */
                        break;
 
                  case HAN_RRECEIPT:    /* give return receipt */
-                       RetReceipt = TRUE;
+                       CurEnv->e_retreceipt = TRUE;
 # ifdef DEBUG
                        if (Debug > 2)
                                printf(">>> Return receipt requested\n");
 # ifdef DEBUG
                        if (Debug > 2)
                                printf(">>> Return receipt requested\n");
index b32e7c9..1ecbae3 100644 (file)
@@ -36,7 +36,7 @@
 
 
 
 
 
 
-SCCSID(@(#)conf.c      3.45            %G%);
+SCCSID(@(#)conf.c      3.46            %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.
@@ -391,7 +391,7 @@ checkcompat(to)
        register STAB *s;
 # endif ING70
 
        register STAB *s;
 # endif ING70
 
-       if (to->q_mailer != LocalMailer && MsgSize > 100000)
+       if (to->q_mailer != LocalMailer && CurEnv->e_msgsize > 100000)
        {
                usrerr("Message exceeds 100000 bytes");
                NoReturn++;
        {
                usrerr("Message exceeds 100000 bytes");
                NoReturn++;
@@ -399,7 +399,7 @@ checkcompat(to)
        }
 # ifdef ING70
        s = stab("arpa", ST_MAILER, ST_FIND);
        }
 # ifdef ING70
        s = stab("arpa", ST_MAILER, ST_FIND);
-       if (s != NULL && From.q_mailer != LocalMailer && to->q_mailer == s->s_mailer)
+       if (s != NULL && CurEnv->e_from.q_mailer != LocalMailer && to->q_mailer == s->s_mailer)
        {
                usrerr("No ARPA mail through this machine: see your system administration");
                return (FALSE);
        {
                usrerr("No ARPA mail through this machine: see your system administration");
                return (FALSE);
index b5b9603..5e4c7b7 100644 (file)
@@ -6,7 +6,7 @@
 # include <syslog.h>
 # endif LOG
 
 # include <syslog.h>
 # endif LOG
 
-SCCSID(@(#)deliver.c   3.78            %G%);
+SCCSID(@(#)deliver.c   3.79            %G%);
 
 /*
 **  DELIVER -- Deliver a message to a list of addresses.
 
 /*
 **  DELIVER -- Deliver a message to a list of addresses.
@@ -82,7 +82,7 @@ deliver(firstto, editfcn)
 
        if (NoConnect && !QueueRun && bitset(M_EXPENSIVE, m->m_flags))
        {
 
        if (NoConnect && !QueueRun && bitset(M_EXPENSIVE, m->m_flags))
        {
-               QueueUp = TRUE;
+               CurEnv->e_queueup = TRUE;
                for (; to != NULL; to = to->q_next)
                        if (!bitset(QDONTSEND, to->q_flags))
                                to->q_flags |= QQUEUEUP|QDONTSEND;
                for (; to != NULL; to = to->q_next)
                        if (!bitset(QDONTSEND, to->q_flags))
                                to->q_flags |= QQUEUEUP|QDONTSEND;
@@ -172,7 +172,7 @@ deliver(firstto, editfcn)
 # ifdef QUEUE
                if (i == EX_TEMPFAIL)
                {
 # ifdef QUEUE
                if (i == EX_TEMPFAIL)
                {
-                       QueueUp = TRUE;
+                       CurEnv->e_queueup = TRUE;
                        tempfail = TRUE;
                }
 # endif QUEUE
                        tempfail = TRUE;
                }
 # endif QUEUE
@@ -191,7 +191,7 @@ deliver(firstto, editfcn)
        */
 
        tobuf[0] = '\0';
        */
 
        tobuf[0] = '\0';
-       To = tobuf;
+       CurEnv->e_to = tobuf;
        ctladdr = NULL;
        for (; to != NULL; to = to->q_next)
        {
        ctladdr = NULL;
        for (; to != NULL; to = to->q_next)
        {
@@ -217,7 +217,7 @@ deliver(firstto, editfcn)
                        ctladdr = getctladdr(to);
 
                user = to->q_user;
                        ctladdr = getctladdr(to);
 
                user = to->q_user;
-               To = to->q_paddr;
+               CurEnv->e_to = to->q_paddr;
                to->q_flags |= QDONTSEND;
                if (tempfail)
                {
                to->q_flags |= QDONTSEND;
                if (tempfail)
                {
@@ -265,7 +265,7 @@ deliver(firstto, editfcn)
 # ifdef QUEUE
                                if (i == EX_TEMPFAIL)
                                {
 # ifdef QUEUE
                                if (i == EX_TEMPFAIL)
                                {
-                                       QueueUp = TRUE;
+                                       CurEnv->e_queueup = TRUE;
                                        to->q_flags |= QQUEUEUP;
                                }
                                else
                                        to->q_flags |= QQUEUEUP;
                                }
                                else
@@ -294,7 +294,7 @@ deliver(firstto, editfcn)
 
                /* save statistics.... */
                Stat.stat_nt[to->q_mailer->m_mno]++;
 
                /* save statistics.... */
                Stat.stat_nt[to->q_mailer->m_mno]++;
-               Stat.stat_bt[to->q_mailer->m_mno] += kbytes(MsgSize);
+               Stat.stat_bt[to->q_mailer->m_mno] += kbytes(CurEnv->e_msgsize);
 
                /*
                **  See if this user name is "special".
 
                /*
                **  See if this user name is "special".
@@ -303,7 +303,7 @@ deliver(firstto, editfcn)
                **      Note that this means that editfcn's will not
                **      be applied to the message.  Also note that
                **      this type of addresses is not processed along
                **      Note that this means that editfcn's will not
                **      be applied to the message.  Also note that
                **      this type of addresses is not processed along
-               **      with the others, so we fudge on the To person.
+               **      with the others, so we fudge on the CurEnv->e_to person.
                */
 
                if (m == LocalMailer)
                */
 
                if (m == LocalMailer)
@@ -359,7 +359,7 @@ deliver(firstto, editfcn)
        }
 
        /* print out messages as full list */
        }
 
        /* print out messages as full list */
-       To = tobuf;
+       CurEnv->e_to = tobuf;
 
        /*
        **  Fill out any parameters after the $u parameter.
 
        /*
        **  Fill out any parameters after the $u parameter.
@@ -385,7 +385,7 @@ deliver(firstto, editfcn)
        if (editfcn == NULL)
                editfcn = putmessage;
        if (ctladdr == NULL)
        if (editfcn == NULL)
                editfcn = putmessage;
        if (ctladdr == NULL)
-               ctladdr = &From;
+               ctladdr = &CurEnv->e_from;
 # ifdef SMTP
        if (clever)
        {
 # ifdef SMTP
        if (clever)
        {
@@ -404,7 +404,7 @@ deliver(firstto, editfcn)
 # ifdef QUEUE
        if (i == EX_TEMPFAIL)
        {
 # ifdef QUEUE
        if (i == EX_TEMPFAIL)
        {
-               QueueUp = TRUE;
+               CurEnv->e_queueup = TRUE;
                for (to = tochain; to != NULL; to = to->q_tchain)
                        to->q_flags |= QQUEUEUP;
        }
                for (to = tochain; to != NULL; to = to->q_tchain)
                        to->q_flags |= QQUEUEUP;
        }
@@ -528,10 +528,10 @@ sendoff(m, pvp, editfcn, ctladdr)
        giveresponse(i, TRUE, m);
 
        /* arrange a return receipt if requested */
        giveresponse(i, TRUE, m);
 
        /* arrange a return receipt if requested */
-       if (RetReceipt && bitset(M_LOCAL, m->m_flags) && i == EX_OK)
+       if (CurEnv->e_retreceipt && bitset(M_LOCAL, m->m_flags) && i == EX_OK)
        {
        {
-               SendReceipt = TRUE;
-               fprintf(Xscript, "%s... successfully delivered\n", To);
+               CurEnv->e_sendreceipt = TRUE;
+               fprintf(Xscript, "%s... successfully delivered\n", CurEnv->e_to);
                /* do we want to send back more info? */
        }
 
                /* do we want to send back more info? */
        }
 
@@ -888,7 +888,7 @@ giveresponse(stat, force, m)
        }
 
 # ifdef LOG
        }
 
 # ifdef LOG
-       syslog(LOG_INFO, "%s->%s: %ld: %s", From.q_paddr, To, MsgSize, statmsg);
+       syslog(LOG_INFO, "%s->%s: %ld: %s", CurEnv->e_from.q_paddr, CurEnv->e_to, CurEnv->e_msgsize, statmsg);
 # endif LOG
 # ifdef QUEUE
        if (stat != EX_TEMPFAIL)
 # endif LOG
 # ifdef QUEUE
        if (stat != EX_TEMPFAIL)
@@ -1014,10 +1014,10 @@ putheader(fp, m)
        char *of_line;
 
        of_line = hvalue("original-from");
        char *of_line;
 
        of_line = hvalue("original-from");
-       for (h = Header; h != NULL; h = h->h_link)
+       for (h = CurEnv->e_header; h != NULL; h = h->h_link)
        {
                register char *p;
        {
                register char *p;
-               char *origfrom = OrigFrom;
+               char *origfrom = CurEnv->e_origfrom;
                bool nooutput;
 
                nooutput = FALSE;
                bool nooutput;
 
                nooutput = FALSE;
@@ -1063,7 +1063,7 @@ putheader(fp, m)
                                        extern bool isatword();
                                        char *oldp;
 
                                        extern bool isatword();
                                        char *oldp;
 
-                                       if (!OldStyle || !isspace(*p))
+                                       if (!CurEnv->e_oldstyle || !isspace(*p))
                                        {
                                                p++;
                                                continue;
                                        {
                                                p++;
                                                continue;
@@ -1377,7 +1377,7 @@ mailfile(filename, ctladdr)
                if (bitset(0111, stb.st_mode))
                        exit(EX_CANTCREAT);
                if (ctladdr == NULL)
                if (bitset(0111, stb.st_mode))
                        exit(EX_CANTCREAT);
                if (ctladdr == NULL)
-                       ctladdr = &From;
+                       ctladdr = &CurEnv->e_from;
                if (!bitset(S_ISGID, stb.st_mode) || setgid(stb.st_gid) < 0)
                {
                        if (ctladdr->q_uid == 0)
                if (!bitset(S_ISGID, stb.st_mode) || setgid(stb.st_gid) < 0)
                {
                        if (ctladdr->q_uid == 0)
@@ -1447,16 +1447,16 @@ sendall(verifyonly)
 # ifdef DEBUG
        if (Debug > 1)
        {
 # ifdef DEBUG
        if (Debug > 1)
        {
-               printf("\nSendQueue:\n");
-               printaddr(SendQueue, TRUE);
+               printf("\nSend Queue:\n");
+               printaddr(CurEnv->e_sendqueue, TRUE);
        }
 # endif DEBUG
 
        }
 # endif DEBUG
 
-       for (q = SendQueue; q != NULL; q = q->q_next)
+       for (q = CurEnv->e_sendqueue; q != NULL; q = q->q_next)
        {
                if (verifyonly)
                {
        {
                if (verifyonly)
                {
-                       To = q->q_paddr;
+                       CurEnv->e_to = q->q_paddr;
                        if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
                        {
                                if (bitset(M_LOCAL, q->q_mailer->m_flags))
                        if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
                        {
                                if (bitset(M_LOCAL, q->q_mailer->m_flags))
index cf7e797..608ae2f 100644 (file)
@@ -3,7 +3,7 @@
 # include <syslog.h>
 # endif LOG
 
 # include <syslog.h>
 # endif LOG
 
-SCCSID(@(#)err.c       3.19            %G%);
+SCCSID(@(#)err.c       3.20            %G%);
 
 /*
 **  SYSERR -- Print error message.
 
 /*
 **  SYSERR -- Print error message.
@@ -64,7 +64,7 @@ syserr(fmt, a, b, c, d, e)
        }
 
 # ifdef LOG
        }
 
 # ifdef LOG
-       syslog(LOG_ERR, "%s->%s: %s", From.q_paddr, To, &errbuf[4]);
+       syslog(LOG_ERR, "%s->%s: %s", CurEnv->e_from.q_paddr, CurEnv->e_to, &errbuf[4]);
 # endif LOG
        errno = 0;
 }
 # endif LOG
        errno = 0;
 }
@@ -121,7 +121,7 @@ message(num, msg, a, b, c, d, e)
        char errbuf[2*BUFSIZ];
 
        errno = 0;
        char errbuf[2*BUFSIZ];
 
        errno = 0;
-       fmtmsg(errbuf, To, num, msg, a, b, c, d, e);
+       fmtmsg(errbuf, CurEnv->e_to, num, msg, a, b, c, d, e);
 
        /* output to transcript */
        fprintf(Xscript, "%s\n", errbuf);
 
        /* output to transcript */
        fprintf(Xscript, "%s\n", errbuf);
index 267bc5e..8c81415 100644 (file)
@@ -1,7 +1,7 @@
 # include <errno.h>
 # include "sendmail.h"
 
 # include <errno.h>
 # include "sendmail.h"
 
-SCCSID(@(#)headers.c   3.17            %G%);
+SCCSID(@(#)headers.c   3.18            %G%);
 
 /*
 **  CHOMPHEADER -- process and save a header line.
 
 /*
 **  CHOMPHEADER -- process and save a header line.
@@ -74,12 +74,12 @@ chompheader(line, def)
        /* hack, hack -- save From: line specially */
        if (!def && !QueueRun && strcmp(fname, "from") == 0)
        {
        /* hack, hack -- save From: line specially */
        if (!def && !QueueRun && strcmp(fname, "from") == 0)
        {
-               OrigFrom = newstr(fvalue);
+               CurEnv->e_origfrom = newstr(fvalue);
                return (0);
        }
 
        /* search header list for this header */
                return (0);
        }
 
        /* search header list for this header */
-       for (hp = &Header, h = Header; h != NULL; hp = &h->h_link, h = h->h_link)
+       for (hp = &CurEnv->e_header, h = CurEnv->e_header; h != NULL; hp = &h->h_link, h = h->h_link)
        {
                if (strcmp(fname, h->h_field) == 0 && bitset(H_DEFAULT, h->h_flags))
                        break;
        {
                if (strcmp(fname, h->h_field) == 0 && bitset(H_DEFAULT, h->h_flags))
                        break;
@@ -125,7 +125,7 @@ chompheader(line, def)
        if (bitset(H_RCPT, h->h_flags) &&
            (index(fvalue, ',') != NULL || index(fvalue, '(') != NULL ||
             index(fvalue, '<') != NULL))
        if (bitset(H_RCPT, h->h_flags) &&
            (index(fvalue, ',') != NULL || index(fvalue, '(') != NULL ||
             index(fvalue, '<') != NULL))
-               OldStyle = FALSE;
+               CurEnv->e_oldstyle = FALSE;
 
        return (h->h_flags);
 }
 
        return (h->h_flags);
 }
@@ -152,7 +152,7 @@ hvalue(field)
 {
        register HDR *h;
 
 {
        register HDR *h;
 
-       for (h = Header; h != NULL; h = h->h_link)
+       for (h = CurEnv->e_header; h != NULL; h = h->h_link)
        {
                if (!bitset(H_DEFAULT, h->h_flags) && strcmp(h->h_field, field) == 0)
                {
        {
                if (!bitset(H_DEFAULT, h->h_flags) && strcmp(h->h_field, field) == 0)
                {
index c08ee56..3f79698 100644 (file)
@@ -7,7 +7,7 @@
 # include <syslog.h>
 # endif LOG
 
 # include <syslog.h>
 # endif LOG
 
-SCCSID(@(#)main.c      3.73            %G%);
+SCCSID(@(#)main.c      3.74            %G%);
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
@@ -102,8 +102,9 @@ SCCSID(@(#)main.c   3.73            %G%);
 
 
 
 
 
 
-int    NextMailer = 0;         /* "free" index into Mailer struct */
+int            NextMailer = 0; /* "free" index into Mailer struct */
 static char    *FullName;      /* sender's full name */
 static char    *FullName;      /* sender's full name */
+ENVELOPE       MainEnvelope;   /* the envelope around the basic letter */
 
 #ifdef DAEMON
 #ifndef SMTP
 
 #ifdef DAEMON
 #ifndef SMTP
@@ -147,6 +148,7 @@ main(argc, argv)
                (void) signal(SIGHUP, finis);
        (void) signal(SIGTERM, finis);
        OldUmask = umask(0);
                (void) signal(SIGHUP, finis);
        (void) signal(SIGTERM, finis);
        OldUmask = umask(0);
+       CurEnv = &MainEnvelope;
 # ifdef LOG
        openlog("sendmail", 0);
 # endif LOG
 # ifdef LOG
        openlog("sendmail", 0);
 # endif LOG
@@ -165,7 +167,7 @@ main(argc, argv)
 # endif
        errno = 0;
        from = NULL;
 # endif
        errno = 0;
        from = NULL;
-       OldStyle = TRUE;
+       CurEnv->e_oldstyle = TRUE;
        initmacros();
 
        /*
        initmacros();
 
        /*
@@ -374,7 +376,7 @@ main(argc, argv)
                        break;
 
                  case 'o':     /* take new-style headers (with commas) */
                        break;
 
                  case 'o':     /* take new-style headers (with commas) */
-                       OldStyle = FALSE;
+                       CurEnv->e_oldstyle = FALSE;
                        break;
 
                  default:
                        break;
 
                  default:
@@ -493,7 +495,7 @@ main(argc, argv)
        */
 
        if (++HopCount > MAXHOP)
        */
 
        if (++HopCount > MAXHOP)
-               syserr("Infinite forwarding loop (%s->%s)", From.q_paddr, *argv);
+               syserr("Infinite forwarding loop (%s->%s)", CurEnv->e_from.q_paddr, *argv);
 
        /*
        **  Scan argv and deliver the message to everyone.
 
        /*
        **  Scan argv and deliver the message to everyone.
@@ -514,7 +516,7 @@ main(argc, argv)
        */
 
        DontSend = FALSE;
        */
 
        DontSend = FALSE;
-       To = NULL;
+       CurEnv->e_to = NULL;
        if (!verifyonly || GrabTo)
                collect(FALSE);
        errno = 0;
        if (!verifyonly || GrabTo)
                collect(FALSE);
        errno = 0;
@@ -544,8 +546,8 @@ main(argc, argv)
        initsys();
 
        /* collect statistics */
        initsys();
 
        /* collect statistics */
-       Stat.stat_nf[From.q_mailer->m_mno]++;
-       Stat.stat_bf[From.q_mailer->m_mno] += kbytes(MsgSize);
+       Stat.stat_nf[CurEnv->e_from.q_mailer->m_mno]++;
+       Stat.stat_bf[CurEnv->e_from.q_mailer->m_mno] += kbytes(CurEnv->e_msgsize);
 
        /*
        **  Arrange that the person who is sending the mail
 
        /*
        **  Arrange that the person who is sending the mail
@@ -554,13 +556,13 @@ main(argc, argv)
 
 # ifdef DEBUG
        if (Debug)
 
 # ifdef DEBUG
        if (Debug)
-               printf("From person = \"%s\"\n", From.q_paddr);
+               printf("From person = \"%s\"\n", CurEnv->e_from.q_paddr);
 # endif DEBUG
 
 # endif DEBUG
 
-       From.q_flags |= QDONTSEND;
+       CurEnv->e_from.q_flags |= QDONTSEND;
        if (!MeToo)
        if (!MeToo)
-               (void) recipient(&From);
-       To = NULL;
+               recipient(&CurEnv->e_from, &CurEnv->e_sendqueue);
+       CurEnv->e_to = NULL;
 
        /*
        **  Actually send everything.
 
        /*
        **  Actually send everything.
@@ -573,7 +575,7 @@ main(argc, argv)
        ** All done.
        */
 
        ** All done.
        */
 
-       To = NULL;
+       CurEnv->e_to = NULL;
        if (!verifyonly)
                poststats(StatFile);
        finis();
        if (!verifyonly)
                poststats(StatFile);
        finis();
@@ -624,7 +626,7 @@ setfrom(from, realname)
        extern char *index();
 
        if (realname == NULL)
        extern char *index();
 
        if (realname == NULL)
-               realname = From.q_paddr;
+               realname = CurEnv->e_from.q_paddr;
 
 # ifdef DEBUG
        if (Debug > 1)
 
 # ifdef DEBUG
        if (Debug > 1)
@@ -646,32 +648,32 @@ setfrom(from, realname)
        }
 
        SuprErrs = TRUE;
        }
 
        SuprErrs = TRUE;
-       if (from == NULL || parse(from, &From, 1) == NULL)
+       if (from == NULL || parse(from, &CurEnv->e_from, 1) == NULL)
        {
                from = newstr(realname);
        {
                from = newstr(realname);
-               (void) parse(from, &From, 1);
+               (void) parse(from, &CurEnv->e_from, 1);
        }
        else
                FromFlag = TRUE;
        SuprErrs = FALSE;
        }
        else
                FromFlag = TRUE;
        SuprErrs = FALSE;
-       From.q_uid = getuid();
-       From.q_gid = getgid();
+       CurEnv->e_from.q_uid = getuid();
+       CurEnv->e_from.q_gid = getgid();
 # ifndef V6
 # ifndef V6
-       From.q_home = getenv("HOME");
+       CurEnv->e_from.q_home = getenv("HOME");
 # endif V6
 # endif V6
-       if (From.q_uid != 0)
+       if (CurEnv->e_from.q_uid != 0)
        {
        {
-               DefUid = From.q_uid;
-               DefGid = From.q_gid;
+               DefUid = CurEnv->e_from.q_uid;
+               DefGid = CurEnv->e_from.q_gid;
        }
 
        /*
        **  Set up the $r and $s macros to show who it came from.
        */
 
        }
 
        /*
        **  Set up the $r and $s macros to show who it came from.
        */
 
-       if (From.q_host != NULL && From.q_host[0] != '\0')
+       if (CurEnv->e_from.q_host != NULL && CurEnv->e_from.q_host[0] != '\0')
        {
        {
-               define('s', From.q_host);
+               define('s', CurEnv->e_from.q_host);
 
                /* should determine network type here */
        }
 
                /* should determine network type here */
        }
@@ -708,12 +710,12 @@ finis()
 {
 # ifdef DEBUG
        if (Debug > 0)
 {
 # ifdef DEBUG
        if (Debug > 0)
-               printf("\n====finis: stat %d SendReceipt %d FatalErrors %d\n",
-                    ExitStat, SendReceipt, FatalErrors);
+               printf("\n====finis: stat %d sendreceipt %d FatalErrors %d\n",
+                    ExitStat, CurEnv->e_sendreceipt, FatalErrors);
 # endif DEBUG
 
        /* send back return receipts as requested */
 # endif DEBUG
 
        /* send back return receipts as requested */
-       if (SendReceipt && ExitStat == EX_OK)
+       if (CurEnv->e_sendreceipt && ExitStat == EX_OK)
                returntosender("Return receipt", FALSE);
 
        /* mail back the transcript on errors */
                returntosender("Return receipt", FALSE);
 
        /* mail back the transcript on errors */
@@ -722,7 +724,7 @@ finis()
 
        if (Transcript != NULL)
                (void) unlink(Transcript);
 
        if (Transcript != NULL)
                (void) unlink(Transcript);
-       if (QueueUp)
+       if (CurEnv->e_queueup)
        {
 # ifdef QUEUE
                queueup(InFileName);
        {
 # ifdef QUEUE
                queueup(InFileName);
index 13baebc..c3784db 100644 (file)
@@ -1,6 +1,6 @@
 # include "sendmail.h"
 
 # include "sendmail.h"
 
-SCCSID(@(#)parseaddr.c 3.40            %G%);
+SCCSID(@(#)parseaddr.c 3.41            %G%);
 
 /*
 **  PARSE -- Parse an address
 
 /*
 **  PARSE -- Parse an address
@@ -55,7 +55,7 @@ parse(addr, a, copyf)
        **  Initialize and prescan address.
        */
 
        **  Initialize and prescan address.
        */
 
-       To = addr;
+       CurEnv->e_to = addr;
 # ifdef DEBUG
        if (Debug)
                printf("\n--parse(%s)\n", addr);
 # ifdef DEBUG
        if (Debug)
                printf("\n--parse(%s)\n", addr);
index 9ce111b..b671582 100644 (file)
@@ -5,10 +5,10 @@
 # include <errno.h>
 
 # ifndef QUEUE
 # include <errno.h>
 
 # ifndef QUEUE
-SCCSID(@(#)queue.c     3.12            %G%     (no queueing));
+SCCSID(@(#)queue.c     3.13            %G%     (no queueing));
 # else QUEUE
 
 # else QUEUE
 
-SCCSID(@(#)queue.c     3.12            %G%);
+SCCSID(@(#)queue.c     3.13            %G%);
 
 /*
 **  QUEUEUP -- queue a message up for future transmission.
 
 /*
 **  QUEUEUP -- queue a message up for future transmission.
@@ -65,13 +65,13 @@ queueup(df)
        fprintf(f, "D%s\n", df);
 
        /* output name of sender */
        fprintf(f, "D%s\n", df);
 
        /* output name of sender */
-       fprintf(f, "S%s\n", From.q_paddr);
+       fprintf(f, "S%s\n", CurEnv->e_from.q_paddr);
 
        /* output timeout */
        fprintf(f, "T%ld\n", TimeOut);
 
        /* output message priority */
 
        /* output timeout */
        fprintf(f, "T%ld\n", TimeOut);
 
        /* output message priority */
-       fprintf(f, "P%ld\n", MsgPriority);
+       fprintf(f, "P%ld\n", CurEnv->e_msgpriority);
 
        /* output macro definitions */
        for (i = 0; i < 128; i++)
 
        /* output macro definitions */
        for (i = 0; i < 128; i++)
@@ -84,7 +84,7 @@ queueup(df)
        }
 
        /* output list of recipient addresses */
        }
 
        /* output list of recipient addresses */
-       for (q = SendQueue; q != NULL; q = q->q_next)
+       for (q = CurEnv->e_sendqueue; q != NULL; q = q->q_next)
        {
 # ifdef DEBUG
                if (Debug > 0)
        {
 # ifdef DEBUG
                if (Debug > 0)
@@ -98,7 +98,7 @@ queueup(df)
        }
 
        /* output headers for this message */
        }
 
        /* output headers for this message */
-       for (h = Header; h != NULL; h = h->h_link)
+       for (h = CurEnv->e_header; h != NULL; h = h->h_link)
        {
                if (h->h_value == NULL || h->h_value[0] == '\0')
                        continue;
        {
                if (h->h_value == NULL || h->h_value[0] == '\0')
                        continue;
@@ -449,7 +449,7 @@ dowork(w)
                if (Debug > 2)
                        printf("CurTime=%ld, TimeOut=%ld\n", CurTime, TimeOut);
 # endif DEBUG
                if (Debug > 2)
                        printf("CurTime=%ld, TimeOut=%ld\n", CurTime, TimeOut);
 # endif DEBUG
-               if (QueueUp && CurTime > TimeOut)
+               if (CurEnv->e_queueup && CurTime > TimeOut)
                        timeout(w);
                (void) unlink(w->w_name);
                finis();
                        timeout(w);
                (void) unlink(w->w_name);
                finis();
@@ -505,7 +505,7 @@ readqf(cf)
        */
 
        if (Verbose)
        */
 
        if (Verbose)
-               message(Arpa_Info, "Running %s (from %s)", cf, From.q_paddr);
+               message(Arpa_Info, "Running %s", cf);
 
        while (fgets(buf, sizeof buf, f) != NULL)
        {
 
        while (fgets(buf, sizeof buf, f) != NULL)
        {
@@ -522,6 +522,8 @@ readqf(cf)
                        break;
 
                  case 'S':             /* sender */
                        break;
 
                  case 'S':             /* sender */
+                       if (Verbose)
+                               message(Arpa_Info, "Sender: %s", &buf[1]);
                        setsender(newstr(&buf[1]));
                        break;
 
                        setsender(newstr(&buf[1]));
                        break;
 
@@ -537,10 +539,10 @@ readqf(cf)
                        break;
 
                  case 'P':             /* message priority */
                        break;
 
                  case 'P':             /* message priority */
-                       (void) sscanf(&buf[1], "%ld", &MsgPriority);
+                       (void) sscanf(&buf[1], "%ld", &CurEnv->e_msgpriority);
 
                        /* make sure that big things get sent eventually */
 
                        /* make sure that big things get sent eventually */
-                       MsgPriority -= WKTIMEFACT;
+                       CurEnv->e_msgpriority -= WKTIMEFACT;
                        break;
 
                  case 'M':             /* define macro */
                        break;
 
                  case 'M':             /* define macro */
@@ -579,7 +581,7 @@ timeout(w)
        (void) returntosender("Cannot send mail for three days");
 
        /* arrange to remove files from queue */
        (void) returntosender("Cannot send mail for three days");
 
        /* arrange to remove files from queue */
-       QueueUp = FALSE;
+       CurEnv->e_queueup = FALSE;
 }
 
 # endif QUEUE
 }
 
 # endif QUEUE
index eba6c88..399ae63 100644 (file)
@@ -2,7 +2,7 @@
 # include "sendmail.h"
 # include <sys/stat.h>
 
 # include "sendmail.h"
 # include <sys/stat.h>
 
-SCCSID(@(#)recipient.c 3.34            %G%);
+SCCSID(@(#)recipient.c 3.35            %G%);
 
 /*
 **  SENDTO -- Designate a send list.
 
 /*
 **  SENDTO -- Designate a send list.
@@ -166,7 +166,7 @@ sendto(list, copyf, ctladdr, qflags)
                }
        }
 
                }
        }
 
-       To = NULL;
+       CurEnv->e_to = NULL;
        if (ctladdr != NULL)
                ctladdr->q_child = prev;
        return (prev);
        if (ctladdr != NULL)
                ctladdr->q_child = prev;
        return (prev);
@@ -234,7 +234,7 @@ recipient(a, sendq)
        extern ADDRESS *getctladdr();
        extern bool safefile();
 
        extern ADDRESS *getctladdr();
        extern bool safefile();
 
-       To = a->q_paddr;
+       CurEnv->e_to = a->q_paddr;
        m = a->q_mailer;
        errno = 0;
 # ifdef DEBUG
        m = a->q_mailer;
        errno = 0;
 # ifdef DEBUG
@@ -547,7 +547,7 @@ include(fname, msg, ctladdr, sendq)
 {
        char buf[MAXLINE];
        register FILE *fp;
 {
        char buf[MAXLINE];
        register FILE *fp;
-       char *oldto = To;
+       char *oldto = CurEnv->e_to;
 
        fp = fopen(fname, "r");
        if (fp == NULL)
 
        fp = fopen(fname, "r");
        if (fp == NULL)
@@ -575,7 +575,7 @@ include(fname, msg, ctladdr, sendq)
                        *p = '\0';
                if (buf[0] == '\0')
                        continue;
                        *p = '\0';
                if (buf[0] == '\0')
                        continue;
-               To = oldto;
+               CurEnv->e_to = oldto;
                if (Verbose)
                        message(Arpa_Info, "%s to %s", msg, buf);
                AliasLevel++;
                if (Verbose)
                        message(Arpa_Info, "%s to %s", msg, buf);
                AliasLevel++;
index c2ed84b..2a59a14 100644 (file)
@@ -1,7 +1,7 @@
 # include <pwd.h>
 # include "sendmail.h"
 
 # include <pwd.h>
 # include "sendmail.h"
 
-SCCSID(@(#)savemail.c  3.27            %G%);
+SCCSID(@(#)savemail.c  3.28            %G%);
 
 /*
 **  SAVEMAIL -- Save mail on error
 
 /*
 **  SAVEMAIL -- Save mail on error
@@ -43,16 +43,16 @@ savemail()
        **  to, make someone up.
        */
 
        **  to, make someone up.
        */
 
-       if (From.q_paddr == NULL)
+       if (CurEnv->e_from.q_paddr == NULL)
        {
        {
-               if (parse("root", &From, 0) == NULL)
+               if (parse("root", &CurEnv->e_from, 0) == NULL)
                {
                        syserr("Cannot parse root!");
                        ExitStat = EX_SOFTWARE;
                        finis();
                }
        }
                {
                        syserr("Cannot parse root!");
                        ExitStat = EX_SOFTWARE;
                        finis();
                }
        }
-       To = NULL;
+       CurEnv->e_to = NULL;
 
        /*
        **  If called from Eric Schmidt's network, do special mailback.
 
        /*
        **  If called from Eric Schmidt's network, do special mailback.
@@ -128,16 +128,16 @@ savemail()
        if (ArpaMode)
                return;
        p = NULL;
        if (ArpaMode)
                return;
        p = NULL;
-       if (From.q_mailer == LocalMailer)
+       if (CurEnv->e_from.q_mailer == LocalMailer)
        {
        {
-               if (From.q_home != NULL)
-                       p = From.q_home;
-               else if ((pw = getpwnam(From.q_user)) != NULL)
+               if (CurEnv->e_from.q_home != NULL)
+                       p = CurEnv->e_from.q_home;
+               else if ((pw = getpwnam(CurEnv->e_from.q_user)) != NULL)
                        p = pw->pw_dir;
        }
        if (p == NULL)
        {
                        p = pw->pw_dir;
        }
        if (p == NULL)
        {
-               syserr("Can't return mail to %s", From.q_paddr);
+               syserr("Can't return mail to %s", CurEnv->e_from.q_paddr);
 # ifdef DEBUG
                p = "/usr/tmp";
 # else
 # ifdef DEBUG
                p = "/usr/tmp";
 # else
@@ -152,7 +152,7 @@ savemail()
                message(Arpa_Info, "Saving message in dead.letter");
                define('z', p);
                (void) expand("$z/dead.letter", buf, &buf[sizeof buf - 1]);
                message(Arpa_Info, "Saving message in dead.letter");
                define('z', p);
                (void) expand("$z/dead.letter", buf, &buf[sizeof buf - 1]);
-               To = buf;
+               CurEnv->e_to = buf;
                q = NULL;
                sendto(buf, -1, (ADDRESS *) NULL, &q);
                (void) deliver(q, (fnptr) NULL);
                q = NULL;
                sendto(buf, -1, (ADDRESS *) NULL, &q);
                (void) deliver(q, (fnptr) NULL);
@@ -196,9 +196,9 @@ returntosender(msg, sendbody)
        SendBody = sendbody;
 
        /* fake up an address header for the from person */
        SendBody = sendbody;
 
        /* fake up an address header for the from person */
-       bmove((char *) &From, (char *) &to_addr, sizeof to_addr);
+       bmove((char *) &CurEnv->e_from, (char *) &to_addr, sizeof to_addr);
        (void) expand("$n", buf, &buf[sizeof buf - 1]);
        (void) expand("$n", buf, &buf[sizeof buf - 1]);
-       if (parse(buf, &From, -1) == NULL)
+       if (parse(buf, &CurEnv->e_from, -1) == NULL)
        {
                syserr("Can't parse myself!");
                ExitStat = EX_SOFTWARE;
        {
                syserr("Can't parse myself!");
                ExitStat = EX_SOFTWARE;
@@ -207,18 +207,18 @@ returntosender(msg, sendbody)
        to_addr.q_next = NULL;
        to_addr.q_flags &= ~QDONTSEND;
        i = deliver(&to_addr, errhdr);
        to_addr.q_next = NULL;
        to_addr.q_flags &= ~QDONTSEND;
        i = deliver(&to_addr, errhdr);
-       bmove((char *) &to_addr, (char *) &From, sizeof From);
+       bmove((char *) &to_addr, (char *) &CurEnv->e_from, sizeof CurEnv->e_from);
 
 
-       /* if From was queued up, put in on SendQueue */
-       if (bitset(QQUEUEUP, From.q_flags))
+       /* if CurEnv->e_from was queued up, put in on CurEnv->e_sendqueue */
+       if (bitset(QQUEUEUP, CurEnv->e_from.q_flags))
        {
        {
-               From.q_next = SendQueue;
-               SendQueue = &From;
+               CurEnv->e_from.q_next = CurEnv->e_sendqueue;
+               CurEnv->e_sendqueue = &CurEnv->e_from;
        }
 
        if (i != 0)
        {
        }
 
        if (i != 0)
        {
-               syserr("Can't return mail to %s", From.q_paddr);
+               syserr("Can't return mail to %s", CurEnv->e_from.q_paddr);
                return (-1);
        }
        return (0);
                return (-1);
        }
        return (0);
@@ -287,7 +287,7 @@ errhdr(fp, m, xdot)
                (void) expand("$g", buf, &buf[sizeof buf - 1]);
                fprintf(fp, "From: %s (Mail Delivery Subsystem)\n", buf);
        }
                (void) expand("$g", buf, &buf[sizeof buf - 1]);
                fprintf(fp, "From: %s (Mail Delivery Subsystem)\n", buf);
        }
-       fprintf(fp, "To: %s\n", To);
+       fprintf(fp, "To: %s\n", CurEnv->e_to);
        fprintf(fp, "Subject: %s\n", ErrorMessage);
 
        /*
        fprintf(fp, "Subject: %s\n", ErrorMessage);
 
        /*
index 812618c..c99d2af 100644 (file)
@@ -7,7 +7,7 @@
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
-static char SmailSccsId[] =    "@(#)sendmail.h 3.66            %G%";
+static char SmailSccsId[] =    "@(#)sendmail.h 3.67            %G%";
 # endif lint
 # else  _DEFINE
 # define EXTERN extern
 # endif lint
 # else  _DEFINE
 # define EXTERN extern
@@ -33,13 +33,7 @@ static char SmailSccsId[] =  "@(#)sendmail.h 3.66            %G%";
 # define SPACESUB      ('.'|0200)      /* substitution for <lwsp> */
 
 extern char    Arpa_Info[];    /* the message number for Arpanet info */
 # define SPACESUB      ('.'|0200)      /* substitution for <lwsp> */
 
 extern char    Arpa_Info[];    /* the message number for Arpanet info */
-
-
-
-
-
-
-/*
+\f/*
 **  Address structure.
 **     Addresses are stored internally in this structure.
 **
 **  Address structure.
 **     Addresses are stored internally in this structure.
 **
@@ -83,12 +77,7 @@ typedef struct address ADDRESS;
 # define QPRIMARY      000010  /* set from argv */
 # define QQUEUEUP      000020  /* queue for later transmission */
 # define QPSEUDO       000040  /* only on the list for verification */
 # define QPRIMARY      000010  /* set from argv */
 # define QQUEUEUP      000020  /* queue for later transmission */
 # define QPSEUDO       000040  /* only on the list for verification */
-
-
-
-
-
-/*
+\f/*
 **  Mailer definition structure.
 **     Every mailer known to the system is declared in this
 **     structure.  It defines the pathname of the mailer, some
 **  Mailer definition structure.
 **     Every mailer known to the system is declared in this
 **     structure.  It defines the pathname of the mailer, some
@@ -138,9 +127,7 @@ EXTERN MAILER       *Mailer[MAXMAILERS+1];
 
 EXTERN MAILER  *LocalMailer;           /* ptr to local mailer */
 EXTERN MAILER  *ProgMailer;            /* ptr to program mailer */
 
 EXTERN MAILER  *LocalMailer;           /* ptr to local mailer */
 EXTERN MAILER  *ProgMailer;            /* ptr to program mailer */
-
-
-/*
+\f/*
 **  Header structure.
 **     This structure is used internally to store header items.
 */
 **  Header structure.
 **     This structure is used internally to store header items.
 */
@@ -156,8 +143,6 @@ struct header
 
 typedef struct header  HDR;
 
 
 typedef struct header  HDR;
 
-EXTERN HDR     *Header;        /* head of header list */
-
 /*
 **  Header information structure.
 **     Defined in conf.c, this struct declares the header fields
 /*
 **  Header information structure.
 **     Defined in conf.c, this struct declares the header fields
@@ -182,10 +167,35 @@ extern struct hdrinfo     HdrInfo[];
 # define H_ACHECK      00040   /* ditto, but always (not just default) */
 # define H_FORCE       00100   /* force this field, even if default */
 # define H_ADDR                00200   /* this field contains addresses */
 # define H_ACHECK      00040   /* ditto, but always (not just default) */
 # define H_FORCE       00100   /* force this field, even if default */
 # define H_ADDR                00200   /* this field contains addresses */
+\f/*
+**  Envelope structure.
+**     This structure defines the message itself.  There is usually
+**     only one of these -- for the message that we originally read
+**     and which is our primary interest -- but other envelopes can
+**     be generated during processing.  For example, error messages
+**     will have their own envelope.
+*/
 
 
+struct envelope
+{
+       HDR     *e_header;      /* head of header list */
+       long    e_msgpriority;  /* adjusted priority of this message */
+       bool    e_queueup;      /* queue this message for future xmission */
+       bool    e_oldstyle;     /* spaces (not commas) delimit addresses */
+       bool    e_retreceipt;   /* give a return receipt if delivery occurs */
+       bool    e_sendreceipt;  /* actually send a receipt back */
+       char    *e_origfrom;    /* the From: line read from the message */
+       char    *e_to;          /* the target person */
+       ADDRESS e_from;         /* the person it is from */
+       ADDRESS *e_sendqueue;   /* list of message recipients */
+       long    e_msgsize;      /* size of the message in bytes */
+       int     (*e_putfunc)(); /* function used to put the message */
+};
 
 
+typedef struct envelope        ENVELOPE;
 
 
-/*
+EXTERN ENVELOPE        *CurEnv;        /* envelope currently being processed */
+\f/*
 **  Work queue.
 */
 
 **  Work queue.
 */
 
@@ -205,7 +215,7 @@ EXTERN WORK *WorkQ;                 /* queue of things to be done */
 **  Message priorities.
 **     Priorities > 0 should be preemptive.
 **
 **  Message priorities.
 **     Priorities > 0 should be preemptive.
 **
-**     MsgPriority is the number of bytes in the message adjusted
+**     CurEnv->e_msgpriority is the number of bytes in the message adjusted
 **     by the message priority and the amount of time the message
 **     has been sitting around.  Each priority point is worth
 **     WKPRIFACT bytes of message, and each time we reprocess a
 **     by the message priority and the amount of time the message
 **     has been sitting around.  Each priority point is worth
 **     WKPRIFACT bytes of message, and each time we reprocess a
@@ -221,12 +231,7 @@ EXTERN WORK        *WorkQ;                 /* queue of things to be done */
 
 # 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 */
-
-EXTERN long    MsgPriority;            /* adjusted priority of this message */
-
-
-
-/*
+\f/*
 **  Rewrite rules.
 */
 
 **  Rewrite rules.
 */
 
@@ -251,10 +256,7 @@ extern struct rewrite      *RewriteRules[];
 # define CONDIF                '\030'  /* conditional if-then */
 # define CONDELSE      '\031'  /* conditional else */
 # define CONDFI                '\032'  /* conditional fi */
 # define CONDIF                '\030'  /* conditional if-then */
 # define CONDELSE      '\031'  /* conditional else */
 # define CONDFI                '\032'  /* conditional fi */
-
-
-
-/*
+\f/*
 **  Symbol table definitions
 */
 
 **  Symbol table definitions
 */
 
@@ -291,11 +293,7 @@ extern STAB        *stab();
 /* opcodes to stab */
 # define ST_FIND       0       /* find entry */
 # define ST_ENTER      1       /* enter if not there */
 /* opcodes to stab */
 # define ST_FIND       0       /* find entry */
 # define ST_ENTER      1       /* enter if not there */
-
-
-
-
-/*
+\f/*
 **  Statistics structure.
 */
 
 **  Statistics structure.
 */
 
@@ -311,11 +309,7 @@ struct statistics
 
 EXTERN struct statistics       Stat;
 extern long                    kbytes();       /* for _bf, _bt */
 
 EXTERN struct statistics       Stat;
 extern long                    kbytes();       /* for _bf, _bt */
-
-
-
-
-/*
+\f/*
 **  Global variables.
 */
 
 **  Global variables.
 */
 
@@ -335,15 +329,11 @@ EXTERN bool       NoReturn;       /* don't return letter to sender */
 EXTERN bool    Daemon;         /* running as a daemon */
 EXTERN bool    Smtp;           /* using SMTP over connection */
 EXTERN bool    SuprErrs;       /* set if we are suppressing errors */
 EXTERN bool    Daemon;         /* running as a daemon */
 EXTERN bool    Smtp;           /* using SMTP over connection */
 EXTERN bool    SuprErrs;       /* set if we are suppressing errors */
-EXTERN bool    QueueUp;        /* queue this message for future xmission */
 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    ForkOff;        /* fork after initial verification */
 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    ForkOff;        /* fork after initial verification */
-EXTERN bool    OldStyle;       /* spaces (not commas) delimit addresses */
 EXTERN bool    NoConnect;      /* don't connect to non-local mailers */
 EXTERN bool    NoConnect;      /* don't connect to non-local mailers */
-EXTERN bool    RetReceipt;     /* give a return receipt if delivery occurs */
-EXTERN bool    SendReceipt;    /* actually send a receipt back */
 EXTERN bool    FatalErrors;    /* set if fatal errors during processing */
 extern time_t  TimeOut;        /* time until timeout */
 EXTERN FILE    *InChannel;     /* input connection */
 EXTERN bool    FatalErrors;    /* set if fatal errors during processing */
 extern time_t  TimeOut;        /* time until timeout */
 EXTERN FILE    *InChannel;     /* input connection */
@@ -361,8 +351,6 @@ EXTERN int  ExitStat;       /* exit status code */
 EXTERN int     HopCount;       /* hop count */
 EXTERN int     AliasLevel;     /* depth of aliasing */
 EXTERN time_t  QueueIntvl;     /* intervals between running the queue */
 EXTERN int     HopCount;       /* hop count */
 EXTERN int     AliasLevel;     /* depth of aliasing */
 EXTERN time_t  QueueIntvl;     /* intervals between running the queue */
-EXTERN char    *OrigFrom;      /* the From: line read from the message */
-EXTERN char    *To;            /* the target person */
 EXTERN char    *HostName;      /* name of this host for SMTP messages */
 EXTERN char    *InFileName;    /* input file name */
 EXTERN char    *Transcript;    /* the transcript file name */
 EXTERN char    *HostName;      /* name of this host for SMTP messages */
 EXTERN char    *InFileName;    /* input file name */
 EXTERN char    *Transcript;    /* the transcript file name */
@@ -371,9 +359,6 @@ extern char *AliasFile;     /* location of alias file */
 extern char    *ConfFile;      /* location of configuration file */
 extern char    *StatFile;      /* location of statistics summary */
 extern char    *QueueDir;      /* location of queue directory */
 extern char    *ConfFile;      /* location of configuration file */
 extern char    *StatFile;      /* location of statistics summary */
 extern char    *QueueDir;      /* location of queue directory */
-EXTERN ADDRESS From;           /* the person it is from */
-EXTERN ADDRESS *SendQueue;     /* list of message recipients */
-EXTERN long    MsgSize;        /* size of the message in bytes */
 EXTERN time_t  CurTime;        /* time of this message */
 
 
 EXTERN time_t  CurTime;        /* time of this message */
 
 
index 7731d43..145e2d0 100644 (file)
@@ -1,10 +1,10 @@
 # include "sendmail.h"
 
 # ifndef SMTP
 # include "sendmail.h"
 
 # ifndef SMTP
-SCCSID(@(#)srvrsmtp.c  3.14            %G%     (no SMTP));
+SCCSID(@(#)srvrsmtp.c  3.15            %G%     (no SMTP));
 # else SMTP
 
 # else SMTP
 
-SCCSID(@(#)srvrsmtp.c  3.14            %G%);
+SCCSID(@(#)srvrsmtp.c  3.15            %G%);
 
 /*
 **  SMTP -- run the SMTP protocol.
 
 /*
 **  SMTP -- run the SMTP protocol.
@@ -78,7 +78,7 @@ smtp()
        message("220", "%s Sendmail at your service", HostName);
        for (;;)
        {
        message("220", "%s Sendmail at your service", HostName);
        for (;;)
        {
-               To = NULL;
+               CurEnv->e_to = NULL;
                Errors = 0;
                if (fgets(inp, sizeof inp, InChannel) == NULL)
                {
                Errors = 0;
                if (fgets(inp, sizeof inp, InChannel) == NULL)
                {
@@ -188,7 +188,7 @@ smtp()
 
                        /* reset strange modes */
                        HoldErrs = FALSE;
 
                        /* reset strange modes */
                        HoldErrs = FALSE;
-                       To = NULL;
+                       CurEnv->e_to = NULL;
 
                        /* issue success if appropriate */
                        if (Errors == 0 || rcps != 1)
 
                        /* issue success if appropriate */
                        if (Errors == 0 || rcps != 1)
@@ -242,8 +242,8 @@ smtp()
 
 # ifdef DEBUG
                  case CMDDBGSHOWQ:     /* show queues */
 
 # ifdef DEBUG
                  case CMDDBGSHOWQ:     /* show queues */
-                       printf("SendQueue=");
-                       printaddr(SendQueue, TRUE);
+                       printf("Send Queue=");
+                       printaddr(CurEnv->e_sendqueue, TRUE);
                        break;
 # endif DEBUG
 
                        break;
 # endif DEBUG
 
index d12234e..077f547 100644 (file)
@@ -1,5 +1,5 @@
 # ifndef lint
 # ifndef lint
-static char    SccsId[] = "@(#)SendMail version 3.103 of %G%";
+static char    SccsId[] = "@(#)SendMail version 3.104 of %G%";
 # endif lint
 
 # endif lint
 
-char   Version[] = "3.103 [%G%]";
+char   Version[] = "3.104 [%G%]";