remove Content-Type: header from returned messages if and only if
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 20 Nov 1994 08:57:53 +0000 (00:57 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 20 Nov 1994 08:57:53 +0000 (00:57 -0800)
no body is to be returned -- this could confuse mail readers

SCCS-vsn: usr.sbin/sendmail/src/usersmtp.c 8.27
SCCS-vsn: usr.sbin/sendmail/src/headers.c 8.42
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 8.71
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 8.37
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 8.108
SCCS-vsn: usr.sbin/sendmail/src/queue.c 8.53
SCCS-vsn: usr.sbin/sendmail/src/conf.c 8.117
SCCS-vsn: usr.sbin/sendmail/src/mime.c 8.9

usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/headers.c
usr/src/usr.sbin/sendmail/src/mime.c
usr/src/usr.sbin/sendmail/src/queue.c
usr/src/usr.sbin/sendmail/src/savemail.c
usr/src/usr.sbin/sendmail/src/sendmail.h
usr/src/usr.sbin/sendmail/src/usersmtp.c

index b9f0e95..c33ae3d 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)conf.c     8.116 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c     8.117 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -93,6 +93,7 @@ struct hdrinfo        HdrInfo[] =
        "comments",                     H_FORCE,
        "return-path",                  H_FORCE|H_ACHECK,
        "content-transfer-encoding",    H_CTE,
        "comments",                     H_FORCE,
        "return-path",                  H_FORCE|H_ACHECK,
        "content-transfer-encoding",    H_CTE,
+       "content-type",                 H_CTYPE,
 
        NULL,                   0,
 };
 
        NULL,                   0,
 };
index 7e54bde..5f17832 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)deliver.c  8.107 (Berkeley) %G%";
+static char sccsid[] = "@(#)deliver.c  8.108 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -1462,8 +1462,8 @@ tryhost:
                */
 
                putfromline(mci, e);
                */
 
                putfromline(mci, e);
-               (*e->e_puthdr)(mci, e->e_header, e);
-               (*e->e_putbody)(mci, e, NULL);
+               (*e->e_puthdr)(mci, e->e_header, e, 0);
+               (*e->e_putbody)(mci, e, NULL, 0);
 
                /* get the exit status */
                rcode = endmailer(mci, e, pv);
 
                /* get the exit status */
                rcode = endmailer(mci, e, pv);
@@ -2116,6 +2116,7 @@ putfromline(mci, e)
 **             e -- the envelope to put out.
 **             separator -- if non-NULL, a message separator that must
 **                     not be permitted in the resulting message.
 **             e -- the envelope to put out.
 **             separator -- if non-NULL, a message separator that must
 **                     not be permitted in the resulting message.
+**             flags -- to modify the behaviour.
 **
 **     Returns:
 **             none.
 **
 **     Returns:
 **             none.
@@ -2129,10 +2130,11 @@ putfromline(mci, e)
 #define OS_CR          1       /* read a carriage return */
 #define OS_INLINE      2       /* putting rest of line */
 
 #define OS_CR          1       /* read a carriage return */
 #define OS_INLINE      2       /* putting rest of line */
 
-putbody(mci, e, separator)
+putbody(mci, e, separator, flags)
        register MCI *mci;
        register ENVELOPE *e;
        char *separator;
        register MCI *mci;
        register ENVELOPE *e;
        char *separator;
+       int flags;
 {
        char buf[MAXLINE];
 
 {
        char buf[MAXLINE];
 
@@ -2504,8 +2506,8 @@ mailfile(filename, ctladdr, e)
                        mcibuf.mci_flags |= MCIF_7BIT;
 
                putfromline(&mcibuf, e);
                        mcibuf.mci_flags |= MCIF_7BIT;
 
                putfromline(&mcibuf, e);
-               (*e->e_puthdr)(&mcibuf, e->e_header, e);
-               (*e->e_putbody)(&mcibuf, e, NULL);
+               (*e->e_puthdr)(&mcibuf, e->e_header, e, 0);
+               (*e->e_putbody)(&mcibuf, e, NULL, 0);
                putline("\n", &mcibuf);
                if (ferror(f))
                {
                putline("\n", &mcibuf);
                if (ferror(f))
                {
index 78e5645..3d9c9f8 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)headers.c  8.41 (Berkeley) %G%";
+static char sccsid[] = "@(#)headers.c  8.42 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <errno.h>
 #endif /* not lint */
 
 # include <errno.h>
@@ -924,6 +924,7 @@ crackaddr(addr)
 **             mci -- the connection information.
 **             h -- the header to put.
 **             e -- envelope to use.
 **             mci -- the connection information.
 **             h -- the header to put.
 **             e -- envelope to use.
+**             flags -- to modify the behaviour.
 **
 **     Returns:
 **             none.
 **
 **     Returns:
 **             none.
@@ -939,10 +940,11 @@ crackaddr(addr)
 # define MAX(a,b) (((a)>(b))?(a):(b))
 #endif
 
 # define MAX(a,b) (((a)>(b))?(a):(b))
 #endif
 
-putheader(mci, h, e)
+putheader(mci, h, e, flags)
        register MCI *mci;
        register HDR *h;
        register ENVELOPE *e;
        register MCI *mci;
        register HDR *h;
        register ENVELOPE *e;
+       int flags;
 {
        char buf[MAX(MAXLINE,BUFSIZ)];
        char obuf[MAXLINE];
 {
        char buf[MAX(MAXLINE,BUFSIZ)];
        char obuf[MAXLINE];
@@ -988,9 +990,18 @@ putheader(mci, h, e)
                        continue;
                }
 
                        continue;
                }
 
+               /* suppress Content-Type: if we are not including the body */
+               if (bitset(PF_NOBODYPART, flags) && bitset(H_CTYPE, h->h_flags))
+               {
+                       if (tTd(34, 11))
+                               printf(" (skipped (content-type))\n");
+                       continue;
+               }
+
                /* suppress Content-Transfer-Encoding: if we are MIMEing */
                if (bitset(H_CTE, h->h_flags) &&
                /* suppress Content-Transfer-Encoding: if we are MIMEing */
                if (bitset(H_CTE, h->h_flags) &&
-                   bitset(MCIF_CVT8TO7, mci->mci_flags))
+                   (bitset(MCIF_CVT8TO7, mci->mci_flags) ||
+                    bitset(PF_NOBODYPART, flags)))
                {
                        if (tTd(34, 11))
                                printf(" (skipped (content-transfer-encoding))\n");
                {
                        if (tTd(34, 11))
                                printf(" (skipped (content-transfer-encoding))\n");
index b74309c..6a6127b 100644 (file)
@@ -10,7 +10,7 @@
 # include <string.h>
 
 #ifndef lint
 # include <string.h>
 
 #ifndef lint
-static char sccsid[] = "@(#)mime.c     8.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)mime.c     8.9 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -137,7 +137,7 @@ mime8to7(mci, header, e, boundary)
                        sprintf(buf, "--%s", bbuf);
                        putline(buf, mci);
                        collect(e->e_dfp, FALSE, FALSE, &hdr, e);
                        sprintf(buf, "--%s", bbuf);
                        putline(buf, mci);
                        collect(e->e_dfp, FALSE, FALSE, &hdr, e);
-                       putheader(mci, hdr, e);
+                       putheader(mci, hdr, e, 0);
                        bt = mime8to7(mci, hdr, e, bbuf);
                }
                sprintf(buf, "--%s--", bbuf);
                        bt = mime8to7(mci, hdr, e, bbuf);
                }
                sprintf(buf, "--%s--", bbuf);
index 240f51f..33d2120 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef QUEUE
 
 #ifndef lint
 #ifdef QUEUE
-static char sccsid[] = "@(#)queue.c    8.52 (Berkeley) %G% (with queueing)";
+static char sccsid[] = "@(#)queue.c    8.53 (Berkeley) %G% (with queueing)";
 #else
 #else
-static char sccsid[] = "@(#)queue.c    8.52 (Berkeley) %G% (without queueing)";
+static char sccsid[] = "@(#)queue.c    8.53 (Berkeley) %G% (without queueing)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -177,7 +177,7 @@ queueup(e, queueall, announce)
                bzero(&mcibuf, sizeof mcibuf);
                mcibuf.mci_out = dfp;
                mcibuf.mci_mailer = FileMailer;
                bzero(&mcibuf, sizeof mcibuf);
                mcibuf.mci_out = dfp;
                mcibuf.mci_mailer = FileMailer;
-               (*e->e_putbody)(&mcibuf, e, NULL);
+               (*e->e_putbody)(&mcibuf, e, NULL, 0);
                (void) xfclose(dfp, "queueup dfp", e->e_id);
                e->e_putbody = putbody;
        }
                (void) xfclose(dfp, "queueup dfp", e->e_id);
                e->e_putbody = putbody;
        }
index 39a6a44..0fac6c3 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)savemail.c 8.36 (Berkeley) %G%";
+static char sccsid[] = "@(#)savemail.c 8.37 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -375,8 +375,8 @@ savemail(e)
                                mcibuf.mci_flags |= MCIF_7BIT;
 
                        putfromline(&mcibuf, e);
                                mcibuf.mci_flags |= MCIF_7BIT;
 
                        putfromline(&mcibuf, e);
-                       (*e->e_puthdr)(&mcibuf, e->e_header, e);
-                       (*e->e_putbody)(&mcibuf, e, NULL);
+                       (*e->e_puthdr)(&mcibuf, e->e_header, e, 0);
+                       (*e->e_putbody)(&mcibuf, e, NULL, 0);
                        putline("\n", &mcibuf);
                        (void) fflush(fp);
                        state = ferror(fp) ? ESM_PANIC : ESM_DONE;
                        putline("\n", &mcibuf);
                        (void) fflush(fp);
                        state = ferror(fp) ? ESM_PANIC : ESM_DONE;
@@ -554,6 +554,7 @@ returntosender(msg, returnq, sendbody, e)
 **             mci -- the mailer connection information.
 **             e -- the envelope we are working in.
 **             separator -- any possible MIME separator.
 **             mci -- the mailer connection information.
 **             e -- the envelope we are working in.
 **             separator -- any possible MIME separator.
+**             flags -- to modify the behaviour.
 **
 **     Returns:
 **             none
 **
 **     Returns:
 **             none
@@ -562,7 +563,7 @@ returntosender(msg, returnq, sendbody, e)
 **             Outputs the body of an error message.
 */
 
 **             Outputs the body of an error message.
 */
 
-errbody(mci, e, separator)
+errbody(mci, e, separator, flags)
        register MCI *mci;
        register ENVELOPE *e;
        char *separator;
        register MCI *mci;
        register ENVELOPE *e;
        char *separator;
@@ -571,6 +572,7 @@ errbody(mci, e, separator)
        char *p;
        register ADDRESS *q;
        bool printheader;
        char *p;
        register ADDRESS *q;
        bool printheader;
+       int pflags = flags;
        char buf[MAXLINE];
 
        if (bitset(MCIF_INHEADER, mci->mci_flags))
        char buf[MAXLINE];
 
        if (bitset(MCIF_INHEADER, mci->mci_flags))
@@ -835,6 +837,8 @@ errbody(mci, e, separator)
 
        if (bitset(EF_NORETURN, e->e_parent->e_flags))
                SendBody = FALSE;
 
        if (bitset(EF_NORETURN, e->e_parent->e_flags))
                SendBody = FALSE;
+       if (!SendBody)
+               pflags |= PF_NOBODYPART;
        putline("", mci);
        if (e->e_parent->e_df != NULL)
        {
        putline("", mci);
        if (e->e_parent->e_df != NULL)
        {
@@ -854,9 +858,9 @@ errbody(mci, e, separator)
                        putline("Content-Type: message/rfc822", mci);
                        putline("", mci);
                }
                        putline("Content-Type: message/rfc822", mci);
                        putline("", mci);
                }
-               putheader(mci, e->e_parent->e_header, e->e_parent);
+               putheader(mci, e->e_parent->e_header, e->e_parent, pflags);
                if (SendBody)
                if (SendBody)
-                       putbody(mci, e->e_parent, e->e_msgboundary);
+                       putbody(mci, e->e_parent, e->e_msgboundary, pflags);
                else
                {
                        putline("", mci);
                else
                {
                        putline("", mci);
index abfb23d..df7fe5b 100644 (file)
@@ -5,7 +5,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)sendmail.h  8.70 (Berkeley) %G%
+ *     @(#)sendmail.h  8.71 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -15,7 +15,7 @@
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
-static char SmailSccsId[] =    "@(#)sendmail.h 8.70            %G%";
+static char SmailSccsId[] =    "@(#)sendmail.h 8.71            %G%";
 # endif
 # else /*  _DEFINE */
 # define EXTERN extern
 # endif
 # else /*  _DEFINE */
 # define EXTERN extern
@@ -276,6 +276,7 @@ extern struct hdrinfo       HdrInfo[];
 # define H_RECEIPTTO   0x0400  /* this field has return receipt info */
 # define H_ERRORSTO    0x0800  /* this field has error address info */
 # define H_CTE         0x1000  /* this field is a content-transfer-encoding */
 # define H_RECEIPTTO   0x0400  /* this field has return receipt info */
 # define H_ERRORSTO    0x0800  /* this field has error address info */
 # define H_CTE         0x1000  /* this field is a content-transfer-encoding */
+# define H_CTYPE       0x2000  /* this is a content-type field */
 \f/*
 **  Information about currently open connections to mailers, or to
 **  hosts that we have looked up recently.
 \f/*
 **  Information about currently open connections to mailers, or to
 **  hosts that we have looked up recently.
@@ -356,9 +357,9 @@ ENVELOPE
        short           e_sendmode;     /* message send mode */
        short           e_errormode;    /* error return mode */
        short           e_timeoutclass; /* message timeout class */
        short           e_sendmode;     /* message send mode */
        short           e_errormode;    /* error return mode */
        short           e_timeoutclass; /* message timeout class */
-       int             (*e_puthdr)__P((MCI *, HDR *, ENVELOPE *));
+       int             (*e_puthdr)__P((MCI *, HDR *, ENVELOPE *, int));
                                        /* function to put header of message */
                                        /* function to put header of message */
-       int             (*e_putbody)__P((MCI *, ENVELOPE *, char *));
+       int             (*e_putbody)__P((MCI *, ENVELOPE *, char *, int));
                                        /* function to put body of message */
        struct envelope *e_parent;      /* the message this one encloses */
        struct envelope *e_sibling;     /* the next envelope of interest */
                                        /* function to put body of message */
        struct envelope *e_parent;      /* the message this one encloses */
        struct envelope *e_sibling;     /* the next envelope of interest */
@@ -789,6 +790,13 @@ struct prival
 #define SFF_ROOTOK             0x0004  /* ok for root to own this file */
 
 
 #define SFF_ROOTOK             0x0004  /* ok for root to own this file */
 
 
+/*
+**  Flags passed to putheader and putbody.
+*/
+
+#define PF_NOBODYPART          0x0001  /* don't send the body part */
+
+
 /*
 **  Regular UNIX sockaddrs are too small to handle ISO addresses, so
 **  we are forced to declare a supertype here.
 /*
 **  Regular UNIX sockaddrs are too small to handle ISO addresses, so
 **  we are forced to declare a supertype here.
index c95408e..a08999d 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef SMTP
 
 #ifndef lint
 #ifdef SMTP
-static char sccsid[] = "@(#)usersmtp.c 8.26 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 8.27 (Berkeley) %G% (with SMTP)";
 #else
 #else
-static char sccsid[] = "@(#)usersmtp.c 8.26 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 8.27 (Berkeley) %G% (without SMTP)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -609,8 +609,8 @@ smtpdata(m, mci, e)
        **  Output the actual message.
        */
 
        **  Output the actual message.
        */
 
-       (*e->e_puthdr)(mci, e->e_header, e);
-       (*e->e_putbody)(mci, e, NULL);
+       (*e->e_puthdr)(mci, e->e_header, e, 0);
+       (*e->e_putbody)(mci, e, NULL, 0);
 
        /*
        **  Cleanup after sending message.
 
        /*
        **  Cleanup after sending message.