put header conditionals into the .cf file
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 5 Nov 1982 05:27:38 +0000 (21:27 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 5 Nov 1982 05:27:38 +0000 (21:27 -0800)
SCCS-mr: usr.sbin/sendmail/doc/op/op.me 037
SCCS-mr: usr.sbin/sendmail/src/main.c 037
SCCS-mr: usr.sbin/sendmail/src/conf.c 037
SCCS-mr: usr.sbin/sendmail/src/sendmail.h 037
SCCS-mr: usr.sbin/sendmail/src/savemail.c 037
SCCS-mr: usr.sbin/sendmail/src/version.c 037
SCCS-mr: usr.sbin/sendmail/src/headers.c 037
SCCS-vsn: usr.sbin/sendmail/doc/op/op.me 1.3
SCCS-vsn: usr.sbin/sendmail/src/main.c 3.128
SCCS-vsn: usr.sbin/sendmail/src/conf.c 3.62
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 3.96
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 3.46
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.236
SCCS-vsn: usr.sbin/sendmail/src/headers.c 3.36

usr/src/usr.sbin/sendmail/doc/op/op.me
usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/headers.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/savemail.c
usr/src/usr.sbin/sendmail/src/sendmail.h
usr/src/usr.sbin/sendmail/src/version.c

index 2613946..3f6fdc0 100644 (file)
@@ -1,6 +1,6 @@
 .ls 2
 .he 'Sendmail Installation and Operation Guide''%'
 .ls 2
 .he 'Sendmail Installation and Operation Guide''%'
-.fo 'Version 1.2'DRAFT'Last Mod %G%'
+.fo 'Version 1.3'DRAFT'Last Mod %G%'
 .nr si 3n
 .de $0
 .(x
 .nr si 3n
 .de $0
 .(x
@@ -2826,55 +2826,41 @@ Let's look at a sample
 specification:
 .(b
 .sz -2
 specification:
 .(b
 .sz -2
-.ta 4n +\w'"return-receipt-to",  'u +\w'H_FROM|H_ACHECK,  'u
+.ta 4n +\w'"return-receipt-to",  'u
 struct hdrinfo HdrInfo[] =
 {
 struct hdrinfo HdrInfo[] =
 {
-               /* date information */
-       "date", H_CHECK,        M_NEEDDATE,
-       "received-date",        H_CHECK,        M_LOCAL,
                /* originator fields, most to least significant  */
                /* originator fields, most to least significant  */
-       "resent-sender",        H_FROM, 0,
-       "resent-from",  H_FROM, 0,
-       "sender",       H_FROM, 0,
-       "from", H_FROM|H_CHECK, M_NEEDFROM,
-       "full-name",    H_ACHECK,       M_FULLNAME,
-       "received-from",        H_CHECK,        M_LOCAL,
+       "resent-sender",        H_FROM,
+       "resent-from",  H_FROM,
+       "sender",       H_FROM,
+       "from", H_FROM,
+       "full-name",    H_ACHECK,
                /* destination fields */
                /* destination fields */
-       "to",   H_RCPT, 0,
-       "resent-to",    H_RCPT, 0,
-       "cc",   H_RCPT, 0,
+       "to",   H_RCPT,
+       "resent-to",    H_RCPT,
+       "cc",   H_RCPT,
                /* message identification and control */
                /* message identification and control */
-       "message-id",   0,      0,
-       "message",      H_EOH,  0,
-       "text", H_EOH,  0,
+       "message",      H_EOH,
+       "text", H_EOH,
                /* trace fields */
                /* trace fields */
-       "received",     H_TRACE|H_FORCE,        0,
+       "received",     H_TRACE|H_FORCE,
 
 
-       NULL,   0,      0,
+       NULL,   0,
 };
 .sz
 .)b
 };
 .sz
 .)b
-This specification says that the
-.q Date: ,
-.q From: ,
-.q Message-Id: ,
-.q Received-Date: ,
-.q Full-Name: ,
-and
-.q Received-From:
-must be requested by the mailer to be inserted.
-However,
-if they were in the message as received by
-.i sendmail
-they will be propagated
-with the exception of the
-.q Full-Name:
-field.
+This structure indicates that the
 .q To: ,
 .q Resent-To: ,
 and
 .q Cc:
 .q To: ,
 .q Resent-To: ,
 and
 .q Cc:
+fields
 all specify recipient addresses.
 all specify recipient addresses.
+Any
+.q Full-Name:
+field will be deleted unless the required mailer flag
+(indicated in the configuration file)
+is specified.
 The
 .q Message:
 and
 The
 .q Message:
 and
@@ -2887,10 +2873,6 @@ The
 .q Received:
 field will always be added,
 and can be used to trace messages.
 .q Received:
 field will always be added,
 and can be used to trace messages.
-The
-other fields
-field are used internally,
-although no cliched special processing occurs.
 .pp
 There are a number of important points here.
 First,
 .pp
 There are a number of important points here.
 First,
index 1d65d5c..c250959 100644 (file)
@@ -32,7 +32,7 @@
 
 
 
 
 
 
-SCCSID(@(#)conf.c      3.61            %G%);
+SCCSID(@(#)conf.c      3.62            %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.
@@ -45,39 +45,30 @@ SCCSID(@(#)conf.c   3.61            %G%);
 
 struct hdrinfo HdrInfo[] =
 {
 
 struct hdrinfo HdrInfo[] =
 {
-               /* date information */
-       "posted-date",          0,                      0,
-       "date",                 H_CHECK,                M_NEEDDATE,
-       "resent-date",          0,                      0,
-       "received-date",        H_CHECK,                M_LOCAL,
                /* originator fields, most to least significant  */
                /* originator fields, most to least significant  */
-       "resent-sender",        H_FROM,                 0,
-       "resent-from",          H_FROM,                 0,
-       "sender",               H_FROM,                 0,
-       "from",                 H_FROM|H_CHECK,         M_NEEDFROM,
-       "full-name",            H_ACHECK,               M_FULLNAME,
-       "received-from",        H_CHECK,                M_LOCAL,
-       "return-receipt-to",    H_FROM,                 0,
-       "errors-to",            H_FROM,                 0,
+       "resent-sender",        H_FROM,
+       "resent-from",          H_FROM,
+       "sender",               H_FROM,
+       "from",                 H_FROM,
+       "full-name",            H_ACHECK,
+       "return-receipt-to",    H_FROM,
+       "errors-to",            H_FROM,
                /* destination fields */
                /* destination fields */
-       "to",                   H_RCPT,                 0,
-       "resent-to",            H_RCPT,                 0,
-       "cc",                   H_RCPT,                 0,
-       "resent-cc",            H_RCPT,                 0,
-       "bcc",                  H_RCPT|H_ACHECK,        0,
-       "resent-bcc",           H_RCPT|H_ACHECK,        0,
+       "to",                   H_RCPT,
+       "resent-to",            H_RCPT,
+       "cc",                   H_RCPT,
+       "resent-cc",            H_RCPT,
+       "bcc",                  H_RCPT|H_ACHECK,
+       "resent-bcc",           H_RCPT|H_ACHECK,
                /* message identification and control */
                /* message identification and control */
-       "message-id",           0,                      0,
-       "resent-message-id",    0,                      0,
-       "precedence",           0,                      0,
-       "message",              H_EOH,                  0,
-       "text",                 H_EOH,                  0,
+       "message",              H_EOH,
+       "text",                 H_EOH,
                /* trace fields */
                /* trace fields */
-       "received",             H_TRACE|H_FORCE,        0,
-       "via",                  H_TRACE|H_FORCE,        0,
-       "mail-from",            H_TRACE|H_FORCE,        0,
+       "received",             H_TRACE|H_FORCE,
+       "via",                  H_TRACE|H_FORCE,
+       "mail-from",            H_TRACE|H_FORCE,
 
 
-       NULL,                   0,                      0,
+       NULL,                   0,
 };
 
 
 };
 
 
index 44f7092..c98251d 100644 (file)
@@ -1,7 +1,7 @@
 # include <errno.h>
 # include "sendmail.h"
 
 # include <errno.h>
 # include "sendmail.h"
 
-SCCSID(@(#)headers.c   3.35            %G%);
+SCCSID(@(#)headers.c   3.36            %G%);
 
 /*
 **  CHOMPHEADER -- process and save a header line.
 
 /*
 **  CHOMPHEADER -- process and save a header line.
@@ -30,6 +30,7 @@ chompheader(line, def)
        char *fname;
        char *fvalue;
        struct hdrinfo *hi;
        char *fname;
        char *fvalue;
        struct hdrinfo *hi;
+       bool cond = FALSE;
        u_long mopts;
        extern u_long mfencode();
        extern char *crackaddr();
        u_long mopts;
        extern u_long mfencode();
        extern char *crackaddr();
@@ -56,6 +57,7 @@ chompheader(line, def)
                }
                else
                        syserr("chompheader: syntax error, line \"%s\"", line);
                }
                else
                        syserr("chompheader: syntax error, line \"%s\"", line);
+               cond = TRUE;
        }
 
        /* find canonical name */
        }
 
        /* find canonical name */
@@ -101,14 +103,14 @@ chompheader(line, def)
                h->h_field = newstr(fname);
                h->h_value = NULL;
                h->h_link = *hp;
                h->h_field = newstr(fname);
                h->h_value = NULL;
                h->h_link = *hp;
-               h->h_mflags = mopts | hi->hi_mflags;
+               h->h_mflags = mopts;
                *hp = h;
        }
        h->h_flags = hi->hi_flags;
        if (def)
                h->h_flags |= H_DEFAULT;
                *hp = h;
        }
        h->h_flags = hi->hi_flags;
        if (def)
                h->h_flags |= H_DEFAULT;
-       else if (mopts == 0)
-               h->h_flags &= ~H_CHECK;
+       if (cond)
+               h->h_flags |= H_CHECK;
        if (h->h_value != NULL)
                free(h->h_value);
                (void) sendto(h->h_value, 0, (ADDRESS *) NULL, 0);
        if (h->h_value != NULL)
                free(h->h_value);
                (void) sendto(h->h_value, 0, (ADDRESS *) NULL, 0);
@@ -173,7 +175,7 @@ addheader(field, value, e)
        h->h_value = newstr(value);
        h->h_link = *hp;
        h->h_flags = hi->hi_flags | H_DEFAULT;
        h->h_value = newstr(value);
        h->h_link = *hp;
        h->h_flags = hi->hi_flags | H_DEFAULT;
-       h->h_mflags = hi->hi_mflags;
+       h->h_mflags = 0;
        *hp = h;
 }
 \f/*
        *hp = h;
 }
 \f/*
index 046ebb1..17b32b5 100644 (file)
@@ -6,7 +6,7 @@
 # include "sendmail.h"
 # include <sys/stat.h>
 
 # include "sendmail.h"
 # include <sys/stat.h>
 
-SCCSID(@(#)main.c      3.127           %G%);
+SCCSID(@(#)main.c      3.128           %G%);
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
 
 /*
 **  SENDMAIL -- Post mail to a set of destinations.
@@ -109,6 +109,7 @@ SCCSID(@(#)main.c   3.127           %G%);
 
 int            NextMailer = 0; /* "free" index into Mailer struct */
 static char    *FullName;      /* sender's full name */
 
 int            NextMailer = 0; /* "free" index into Mailer struct */
 static char    *FullName;      /* sender's full name */
+ENVELOPE       BlankEnvelope;  /* a "blank" envelope */
 ENVELOPE       MainEnvelope;   /* the envelope around the basic letter */
 
 #ifdef DAEMON
 ENVELOPE       MainEnvelope;   /* the envelope around the basic letter */
 
 #ifdef DAEMON
@@ -132,16 +133,17 @@ main(argc, argv)
        extern char Version[];
        char *from;
        typedef int (*fnptr)();
        extern char Version[];
        char *from;
        typedef int (*fnptr)();
+       STAB *st;
        register int i;
        bool safecf = TRUE;             /* this conf file is sys default */
        register int i;
        bool safecf = TRUE;             /* this conf file is sys default */
-       char jbuf[30];                  /* holds HostName */
        bool queuemode = FALSE;         /* process queue requests */
        bool aliasinit = FALSE;
        bool queuemode = FALSE;         /* process queue requests */
        bool aliasinit = FALSE;
+       static bool reenter = FALSE;
+       char jbuf[30];                  /* holds HostName */
        extern bool safefile();
        extern bool safefile();
-       STAB *st;
        extern time_t convtime();
        extern putheader(), putbody();
        extern time_t convtime();
        extern putheader(), putbody();
-       static bool reenter = FALSE;
+       extern ENVELOPE *newenvelope();
 
        if (reenter)
        {
 
        if (reenter)
        {
@@ -167,10 +169,10 @@ main(argc, argv)
        FullName = getenv("NAME");
 # endif V6
 
        FullName = getenv("NAME");
 # endif V6
 
-       /* set up the main envelope */
-       MainEnvelope.e_puthdr = putheader;
-       MainEnvelope.e_putbody = putbody;
-       CurEnv = &MainEnvelope;
+       /* set up the blank envelope */
+       BlankEnvelope.e_puthdr = putheader;
+       BlankEnvelope.e_putbody = putbody;
+       CurEnv = &BlankEnvelope;
 
 # ifdef LOG
        openlog("sendmail", 0);
 
 # ifdef LOG
        openlog("sendmail", 0);
@@ -381,6 +383,12 @@ main(argc, argv)
        }
 # endif DEBUG
 
        }
 # endif DEBUG
 
+       /*
+       **  Switch to the main envelope.
+       */
+
+       CurEnv = newenvelope(&MainEnvelope);
+
        /*
        **  If test mode, read addresses from stdin and process.
        */
        /*
        **  If test mode, read addresses from stdin and process.
        */
@@ -889,7 +897,7 @@ openxscrpt()
                syserr("Can't create %s", p);
        }
        Transcript = p;
                syserr("Can't create %s", p);
        }
        Transcript = p;
-       (void) chmod(p, FileMode);
+       (void) chmod(p, 0644);
 }
 \f/*
 **  SETSENDER -- set sendmail's idea of the sender.
 }
 \f/*
 **  SETSENDER -- set sendmail's idea of the sender.
@@ -1159,12 +1167,24 @@ ENVELOPE *
 newenvelope(e)
        register ENVELOPE *e;
 {
 newenvelope(e)
        register ENVELOPE *e;
 {
+       register HDR *bh;
+       register HDR **nhp;
+
        clear((char *) e, sizeof *e);
        bmove(&CurEnv->e_from, &e->e_from, sizeof e->e_from);
        e->e_parent = CurEnv;
        e->e_ctime = curtime();
        e->e_puthdr = CurEnv->e_puthdr;
        e->e_putbody = CurEnv->e_putbody;
        clear((char *) e, sizeof *e);
        bmove(&CurEnv->e_from, &e->e_from, sizeof e->e_from);
        e->e_parent = CurEnv;
        e->e_ctime = curtime();
        e->e_puthdr = CurEnv->e_puthdr;
        e->e_putbody = CurEnv->e_putbody;
+       bh = BlankEnvelope.e_header;
+       nhp = &e->e_header;
+       while (bh != NULL)
+       {
+               *nhp = (HDR *) xalloc(sizeof *bh);
+               bmove((char *) bh, (char *) *nhp, sizeof *bh);
+               bh = bh->h_link;
+               nhp = &(*nhp)->h_link;
+       }
 
        return (e);
 }
 
        return (e);
 }
index 2ba420c..a7876ad 100644 (file)
@@ -1,7 +1,7 @@
 # include <pwd.h>
 # include "sendmail.h"
 
 # include <pwd.h>
 # include "sendmail.h"
 
-SCCSID(@(#)savemail.c  3.45            %G%);
+SCCSID(@(#)savemail.c  3.46            %G%);
 
 /*
 **  SAVEMAIL -- Save mail on error
 
 /*
 **  SAVEMAIL -- Save mail on error
@@ -242,8 +242,6 @@ returntosender(msg, returnto, sendbody)
        ee->e_puthdr = putheader;
        ee->e_putbody = errbody;
        queuename(ee, '\0');
        ee->e_puthdr = putheader;
        ee->e_putbody = errbody;
        queuename(ee, '\0');
-       addheader("date", "$b", ee);
-       addheader("from", "$g (Mail Delivery Subsystem)", ee);
        addheader("to", returnto->q_paddr, ee);
        addheader("subject", msg, ee);
 
        addheader("to", returnto->q_paddr, ee);
        addheader("subject", msg, ee);
 
@@ -304,19 +302,25 @@ errbody(fp, m, xdot)
        char buf[MAXLINE];
        bool fullsmtp = bitset(M_FULLSMTP, m->m_flags);
 
        char buf[MAXLINE];
        bool fullsmtp = bitset(M_FULLSMTP, m->m_flags);
 
-       (void) fflush(stdout);
-       if ((xfile = fopen(Transcript, "r")) == NULL)
-               syserr("Cannot open %s", Transcript);
-       errno = 0;
-
        /*
        **  Output transcript of errors
        */
 
        /*
        **  Output transcript of errors
        */
 
-       fprintf(fp, "   ----- Transcript of session follows -----\n");
-       (void) fflush(Xscript);
-       while (fgets(buf, sizeof buf, xfile) != NULL)
-               putline(buf, fp, fullsmtp);
+       (void) fflush(stdout);
+       if ((xfile = fopen(Transcript, "r")) == NULL)
+       {
+               syserr("Cannot open %s", Transcript);
+               fprintf(fp, "  ----- Transcript of session is unavailable -----\n");
+       }
+       else
+       {
+               fprintf(fp, "   ----- Transcript of session follows -----\n");
+               (void) fflush(Xscript);
+               while (fgets(buf, sizeof buf, xfile) != NULL)
+                       putline(buf, fp, fullsmtp);
+               (void) fclose(xfile);
+       }
+       errno = 0;
 
        /*
        **  Output text of original message
 
        /*
        **  Output text of original message
@@ -348,7 +352,6 @@ errbody(fp, m, xdot)
        **  Cleanup and exit
        */
 
        **  Cleanup and exit
        */
 
-       (void) fclose(xfile);
        if (errno != 0)
                syserr("errbody: I/O error");
 }
        if (errno != 0)
                syserr("errbody: I/O error");
 }
index 8671430..ed29700 100644 (file)
@@ -7,7 +7,7 @@
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
-static char SmailSccsId[] =    "@(#)sendmail.h 3.95            %G%";
+static char SmailSccsId[] =    "@(#)sendmail.h 3.96            %G%";
 # endif lint
 # else  _DEFINE
 # define EXTERN extern
 # endif lint
 # else  _DEFINE
 # define EXTERN extern
@@ -158,7 +158,6 @@ struct hdrinfo
 {
        char    *hi_field;      /* the name of the field */
        u_short hi_flags;       /* status bits, see below */
 {
        char    *hi_field;      /* the name of the field */
        u_short hi_flags;       /* status bits, see below */
-       u_short hi_mflags;      /* m_flags needed for this field */
 };
 
 extern struct hdrinfo  HdrInfo[];
 };
 
 extern struct hdrinfo  HdrInfo[];
index fa57d69..e0ff162 100644 (file)
@@ -1,5 +1,5 @@
 # ifndef lint
 # ifndef lint
-static char    SccsId[] = "@(#)SendMail version 3.235 of %G%";
+static char    SccsId[] = "@(#)SendMail version 3.236 of %G%";
 # endif lint
 
 # endif lint
 
-char   Version[] = "3.235 [%G%]";
+char   Version[] = "3.236 [%G%]";