new DSN draft
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Wed, 22 Mar 1995 01:27:04 +0000 (17:27 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Wed, 22 Mar 1995 01:27:04 +0000 (17:27 -0800)
SCCS-vsn: usr.sbin/sendmail/src/usersmtp.c 8.39
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 8.73
SCCS-vsn: usr.sbin/sendmail/src/envelope.c 8.53
SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 8.59
SCCS-vsn: usr.sbin/sendmail/src/collect.c 8.29
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 8.104
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 8.57
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 8.57
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 8.131
SCCS-vsn: usr.sbin/sendmail/src/queue.c 8.70
SCCS-vsn: usr.sbin/sendmail/src/conf.c 8.141

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/envelope.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/usersmtp.c

index 0810980..45b744e 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)collect.c  8.28 (Berkeley) %G%";
+static char sccsid[] = "@(#)collect.c  8.29 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <errno.h>
 #endif /* not lint */
 
 # include <errno.h>
@@ -100,7 +100,7 @@ maketemp(from)
                if ((tf = dfopen(e->e_df, O_WRONLY|O_CREAT|O_TRUNC, FileMode)) == NULL)
                {
                        syserr("Cannot create %s", e->e_df);
                if ((tf = dfopen(e->e_df, O_WRONLY|O_CREAT|O_TRUNC, FileMode)) == NULL)
                {
                        syserr("Cannot create %s", e->e_df);
-                       e->e_flags |= EF_NORETURN;
+                       e->e_flags |= EF_NO_BODY_RETN;
                        finis();
                }
                if (fstat(fileno(tf), &stbuf) < 0)
                        finis();
                }
                if (fstat(fileno(tf), &stbuf) < 0)
@@ -575,7 +575,7 @@ tferror(tf, e)
                long avail;
                long bsize;
 
                long avail;
                long bsize;
 
-               e->e_flags |= EF_NORETURN;
+               e->e_flags |= EF_NO_BODY_RETN;
                if (fstat(fileno(tf), &st) < 0)
                        st.st_size = 0;
                (void) freopen(e->e_df, "w", tf);
                if (fstat(fileno(tf), &st) < 0)
                        st.st_size = 0;
                (void) freopen(e->e_df, "w", tf);
index c314d0c..409f246 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)conf.c     8.140 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c     8.141 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -854,8 +854,10 @@ ttypath()
 **     message should be given using "usrerr" and 0 should
 **     be returned.
 **
 **     message should be given using "usrerr" and 0 should
 **     be returned.
 **
-**     EF_NORETURN can be set in e->e_flags to suppress the return-to-sender
-**     function; this should be done on huge messages.
+**     EF_NO_BODY_RETN can be set in e->e_flags to suppress the
+**     body during the return-to-sender function; this should be done
+**     on huge messages.  This bit may already be set by the ESMTP
+**     protocol.
 **
 **     Parameters:
 **             to -- the person being sent to.
 **
 **     Parameters:
 **             to -- the person being sent to.
@@ -890,7 +892,7 @@ checkcompat(to, e)
            to->q_mailer == s->s_mailer)
        {
                usrerr("553 No ARPA mail through this machine: see your system administration");
            to->q_mailer == s->s_mailer)
        {
                usrerr("553 No ARPA mail through this machine: see your system administration");
-               /* e->e_flags |= EF_NORETURN; to supress return copy */
+               /* e->e_flags |= EF_NO_BODY_RETN; to supress body on return */
                return (EX_UNAVAILABLE);
        }
 # endif /* EXAMPLE_CODE */
                return (EX_UNAVAILABLE);
        }
 # endif /* EXAMPLE_CODE */
index 831fe2c..af40cf4 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)deliver.c  8.130 (Berkeley) %G%";
+static char sccsid[] = "@(#)deliver.c  8.131 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -839,7 +839,7 @@ deliver(e, firstto)
 
                if (m->m_maxsize != 0 && e->e_msgsize > m->m_maxsize)
                {
 
                if (m->m_maxsize != 0 && e->e_msgsize > m->m_maxsize)
                {
-                       e->e_flags |= EF_NORETURN;
+                       e->e_flags |= EF_NO_BODY_RETN;
                        usrerr("552 Message is too large; %ld bytes max", m->m_maxsize);
                        giveresponse(EX_UNAVAILABLE, m, NULL, ctladdr, xstart, e);
                        continue;
                        usrerr("552 Message is too large; %ld bytes max", m->m_maxsize);
                        giveresponse(EX_UNAVAILABLE, m, NULL, ctladdr, xstart, e);
                        continue;
@@ -1475,7 +1475,7 @@ tryhost:
                                rcode, mci->mci_state, firstsig);
                        rcode = EX_SOFTWARE;
                }
                                rcode, mci->mci_state, firstsig);
                        rcode = EX_SOFTWARE;
                }
-               else if (rcode == EX_TEMPFAIL && curhost != NULL && *curhost != '\0')
+               else if (curhost != NULL && *curhost != '\0')
                {
                        /* try next MX site */
                        goto tryhost;
                {
                        /* try next MX site */
                        goto tryhost;
index c0ad199..177a317 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)envelope.c 8.52 (Berkeley) %G%";
+static char sccsid[] = "@(#)envelope.c 8.53 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -78,7 +78,6 @@ dropenvelope(e)
        bool success_return = FALSE;
        register ADDRESS *q;
        char *id = e->e_id;
        bool success_return = FALSE;
        register ADDRESS *q;
        char *id = e->e_id;
-       bool return_no, return_yes;
        char buf[MAXLINE];
 
        if (tTd(50, 1))
        char buf[MAXLINE];
 
        if (tTd(50, 1))
@@ -114,7 +113,6 @@ dropenvelope(e)
        */
 
        e->e_flags &= ~EF_QUEUERUN;
        */
 
        e->e_flags &= ~EF_QUEUERUN;
-       return_no = return_yes = FALSE;
        for (q = e->e_sendqueue; q != NULL; q = q->q_next)
        {
                if (bitset(QQUEUEUP, q->q_flags))
        for (q = e->e_sendqueue; q != NULL; q = q->q_next)
        {
                if (bitset(QQUEUEUP, q->q_flags))
@@ -141,21 +139,13 @@ dropenvelope(e)
                        success_return = TRUE;
                }
                else
                        success_return = TRUE;
                }
                else
-                       continue;
-
-               /* common code for error returns and return receipts */
-
-               /* test for returning the body */
-               if (bitset(QHAS_RET_PARAM, q->q_flags))
                {
                {
-                       if (bitset(QRET_HDRS, q->q_flags))
-                               return_no = TRUE;
-                       else
-                               return_yes = TRUE;
+                       continue;
                }
        }
                }
        }
-       if (return_no && !return_yes)
-               e->e_flags |= EF_NORETURN;
+
+       if (e->e_class < 0)
+               e->e_flags |= EF_NO_BODY_RETN;
 
        /*
        **  See if the message timed out.
 
        /*
        **  See if the message timed out.
@@ -258,7 +248,7 @@ dropenvelope(e)
 
                e->e_flags |= EF_SENDRECEIPT;
                (void) sendtolist(e->e_receiptto, NULLADDR, &rlist, 0, e);
 
                e->e_flags |= EF_SENDRECEIPT;
                (void) sendtolist(e->e_receiptto, NULLADDR, &rlist, 0, e);
-               (void) returntosender("Return receipt", rlist, return_yes, e);
+               (void) returntosender("Return receipt", rlist, FALSE, e);
        }
        e->e_flags &= ~EF_SENDRECEIPT;
 
        }
        e->e_flags &= ~EF_SENDRECEIPT;
 
@@ -267,7 +257,7 @@ dropenvelope(e)
        */
 
        if (failure_return && e->e_errormode != EM_QUIET)
        */
 
        if (failure_return && e->e_errormode != EM_QUIET)
-               savemail(e, return_yes || (!return_no && e->e_class >= 0));
+               savemail(e, !bitset(EF_NO_BODY_RETN, e->e_flags));
 
        /*
        **  Arrange to send warning messages to postmaster as requested.
 
        /*
        **  Arrange to send warning messages to postmaster as requested.
index b6bed80..672fcf7 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)parseaddr.c        8.58.1.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)parseaddr.c        8.59 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -1982,8 +1982,6 @@ struct qflags     AddressFlags[] =
        "QPINGONSUCCESS",       QPINGONSUCCESS,
        "QPINGONFAILURE",       QPINGONFAILURE,
        "QPINGONDELAY",         QPINGONDELAY,
        "QPINGONSUCCESS",       QPINGONSUCCESS,
        "QPINGONFAILURE",       QPINGONFAILURE,
        "QPINGONDELAY",         QPINGONDELAY,
-       "QHAS_RET_PARAM",       QHAS_RET_PARAM,
-       "QRET_HDRS",            QRET_HDRS,
        "QRELAYED",             QRELAYED,
        NULL
 };
        "QRELAYED",             QRELAYED,
        NULL
 };
index 9d13319..893fa64 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef QUEUE
 
 #ifndef lint
 #ifdef QUEUE
-static char sccsid[] = "@(#)queue.c    8.69 (Berkeley) %G% (with queueing)";
+static char sccsid[] = "@(#)queue.c    8.70 (Berkeley) %G% (with queueing)";
 #else
 #else
-static char sccsid[] = "@(#)queue.c    8.69 (Berkeley) %G% (without queueing)";
+static char sccsid[] = "@(#)queue.c    8.70 (Berkeley) %G% (without queueing)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
index 03556bf..9cb3bff 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)recipient.c        8.72 (Berkeley) %G%";
+static char sccsid[] = "@(#)recipient.c        8.73 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -48,7 +48,7 @@ static char sccsid[] = "@(#)recipient.c       8.72 (Berkeley) %G%";
 #define MAXRCRSN       10      /* maximum levels of alias recursion */
 
 /* q_flags bits inherited from ctladdr */
 #define MAXRCRSN       10      /* maximum levels of alias recursion */
 
 /* q_flags bits inherited from ctladdr */
-#define QINHERITEDBITS (QPINGONSUCCESS|QPINGONFAILURE|QPINGONDELAY|QHAS_RET_PARAM|QRET_HDRS)
+#define QINHERITEDBITS (QPINGONSUCCESS|QPINGONFAILURE|QPINGONDELAY)
 
 int
 ADDRESS *
 
 int
 ADDRESS *
index 5cfa6e8..0c9b2c4 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)savemail.c 8.56 (Berkeley) %G%";
+static char sccsid[] = "@(#)savemail.c 8.57 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -423,8 +423,6 @@ savemail(e, sendbody)
 **             mail.
 */
 
 **             mail.
 */
 
-static bool    SendBody;
-
 #define MAXRETURNS     6       /* max depth of returning messages */
 #define ERRORFUDGE     100     /* nominal size of error message text */
 
 #define MAXRETURNS     6       /* max depth of returning messages */
 #define ERRORFUDGE     100     /* nominal size of error message text */
 
@@ -470,7 +468,6 @@ returntosender(msg, returnq, sendbody, e)
                return (0);
        }
 
                return (0);
        }
 
-       SendBody = sendbody;
        define('g', e->e_from.q_paddr, e);
        define('u', NULL, e);
 
        define('g', e->e_from.q_paddr, e);
        define('u', NULL, e);
 
@@ -487,7 +484,7 @@ returntosender(msg, returnq, sendbody, e)
                ee->e_flags &= ~EF_OLDSTYLE;
        ee->e_sendqueue = returnq;
        ee->e_msgsize = ERRORFUDGE;
                ee->e_flags &= ~EF_OLDSTYLE;
        ee->e_sendqueue = returnq;
        ee->e_msgsize = ERRORFUDGE;
-       if (!bitset(EF_NORETURN, e->e_flags))
+       if (sendbody)
                ee->e_msgsize += e->e_msgsize;
        initsys(ee);
        for (q = returnq; q != NULL; q = q->q_next)
                ee->e_msgsize += e->e_msgsize;
        initsys(ee);
        for (q = returnq; q != NULL; q = q->q_next)
@@ -586,6 +583,7 @@ errbody(mci, e, separator)
        char *p;
        register ADDRESS *q;
        bool printheader;
        char *p;
        register ADDRESS *q;
        bool printheader;
+       bool sendbody;
        char buf[MAXLINE];
        extern char *xtextify();
 
        char buf[MAXLINE];
        extern char *xtextify();
 
@@ -892,14 +890,14 @@ errbody(mci, e, separator)
        **  Output text of original message
        */
 
        **  Output text of original message
        */
 
-       if (bitset(EF_NORETURN, e->e_parent->e_flags))
-               SendBody = FALSE;
        putline("", mci);
        if (e->e_parent->e_df != NULL)
        {
        putline("", mci);
        if (e->e_parent->e_df != NULL)
        {
+               sendbody = !bitset(EF_NO_BODY_RETN, e->e_parent->e_flags);
+
                if (e->e_msgboundary == NULL)
                {
                if (e->e_msgboundary == NULL)
                {
-                       if (SendBody)
+                       if (sendbody)
                                putline("   ----- Original message follows -----\n", mci);
                        else
                                putline("   ----- Message header follows -----\n", mci);
                                putline("   ----- Original message follows -----\n", mci);
                        else
                                putline("   ----- Message header follows -----\n", mci);
@@ -910,12 +908,12 @@ errbody(mci, e, separator)
                        (void) sprintf(buf, "--%s", e->e_msgboundary);
                        putline(buf, mci);
                        (void) sprintf(buf, "Content-Type: message/rfc822%s",
                        (void) sprintf(buf, "--%s", e->e_msgboundary);
                        putline(buf, mci);
                        (void) sprintf(buf, "Content-Type: message/rfc822%s",
-                               mci, SendBody ? "" : "-headers");
+                               mci, sendbody ? "" : "-headers");
                        putline(buf, mci);
                }
                putline("", mci);
                putheader(mci, e->e_parent->e_header, e->e_parent);
                        putline(buf, mci);
                }
                putline("", mci);
                putheader(mci, e->e_parent->e_header, e->e_parent);
-               if (SendBody)
+               if (sendbody)
                        putbody(mci, e->e_parent, e->e_msgboundary);
                else if (e->e_msgboundary == NULL)
                {
                        putbody(mci, e->e_parent, e->e_msgboundary);
                else if (e->e_msgboundary == NULL)
                {
index 7201b3f..e0e2e39 100644 (file)
@@ -5,7 +5,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)sendmail.h  8.103 (Berkeley) %G%
+ *     @(#)sendmail.h  8.104 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -15,7 +15,7 @@
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
-static char SmailSccsId[] =    "@(#)sendmail.h 8.103           %G%";
+static char SmailSccsId[] =    "@(#)sendmail.h 8.104           %G%";
 # endif
 # else /*  _DEFINE */
 # define EXTERN extern
 # endif
 # else /*  _DEFINE */
 # define EXTERN extern
@@ -144,8 +144,6 @@ typedef struct address ADDRESS;
 # define QPINGONSUCCESS        0x00001000      /* give return on successful delivery */
 # define QPINGONFAILURE        0x00002000      /* give return on failure */
 # define QPINGONDELAY  0x00004000      /* give return on message delay */
 # define QPINGONSUCCESS        0x00001000      /* give return on successful delivery */
 # define QPINGONFAILURE        0x00002000      /* give return on failure */
 # define QPINGONDELAY  0x00004000      /* give return on message delay */
-# define QHAS_RET_PARAM        0x00008000      /* RCPT command had RET argument */
-# define QRET_HDRS     0x00010000      /* don't return message body */
 # define QRELAYED      0x00020000      /* relayed to non-DSN aware mailer */
 
 # define NULLADDR      ((ADDRESS *) NULL)
 # define QRELAYED      0x00020000      /* relayed to non-DSN aware mailer */
 
 # define NULLADDR      ((ADDRESS *) NULL)
@@ -324,6 +322,7 @@ MCI
 #define MCIF_INHEADER  0x0200          /* currently outputing header */
 #define MCIF_CVT8TO7   0x0400          /* convert from 8 to 7 bits */
 #define MCIF_DSN       0x0800          /* DSN extension supported */
 #define MCIF_INHEADER  0x0200          /* currently outputing header */
 #define MCIF_CVT8TO7   0x0400          /* convert from 8 to 7 bits */
 #define MCIF_DSN       0x0800          /* DSN extension supported */
+#define MCIF_8BITOK    0x1000          /* OK to send 8 bit characters */
 
 /* states */
 #define MCIS_CLOSED    0               /* no traffic on this connection */
 
 /* states */
 #define MCIS_CLOSED    0               /* no traffic on this connection */
@@ -394,7 +393,7 @@ ENVELOPE
 /* values for e_flags */
 #define EF_OLDSTYLE    0x0000001       /* use spaces (not commas) in hdrs */
 #define EF_INQUEUE     0x0000002       /* this message is fully queued */
 /* values for e_flags */
 #define EF_OLDSTYLE    0x0000001       /* use spaces (not commas) in hdrs */
 #define EF_INQUEUE     0x0000002       /* this message is fully queued */
-#define EF_NORETURN    0x0000004       /* don't return the message on error */
+#define EF_NO_BODY_RETN        0x0000004       /* omit message body on error */
 #define EF_CLRQUEUE    0x0000008       /* disk copy is no longer needed */
 #define EF_SENDRECEIPT 0x0000010       /* send a return receipt */
 #define EF_FATALERRS   0x0000020       /* fatal errors occured */
 #define EF_CLRQUEUE    0x0000008       /* disk copy is no longer needed */
 #define EF_SENDRECEIPT 0x0000010       /* send a return receipt */
 #define EF_FATALERRS   0x0000020       /* fatal errors occured */
@@ -412,6 +411,7 @@ ENVELOPE
 #define EF_HAS8BIT     0x0020000       /* at least one 8-bit char in body */
 #define EF_NL_NOT_EOL  0x0040000       /* don't accept raw NL as EOLine */
 #define EF_CRLF_NOT_EOL        0x0080000       /* don't accept CR-LF as EOLine */
 #define EF_HAS8BIT     0x0020000       /* at least one 8-bit char in body */
 #define EF_NL_NOT_EOL  0x0040000       /* don't accept raw NL as EOLine */
 #define EF_CRLF_NOT_EOL        0x0080000       /* don't accept CR-LF as EOLine */
+#define EF_RET_PARAM   0x0100000       /* RCPT command had RET argument */
 
 EXTERN ENVELOPE        *CurEnv;        /* envelope currently being processed */
 \f/*
 
 EXTERN ENVELOPE        *CurEnv;        /* envelope currently being processed */
 \f/*
index 8a0d0bd..d2016d1 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef SMTP
 
 #ifndef lint
 #ifdef SMTP
-static char sccsid[] = "@(#)srvrsmtp.c 8.56 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.57 (Berkeley) %G% (with SMTP)";
 #else
 #else
-static char sccsid[] = "@(#)srvrsmtp.c 8.56 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.57 (Berkeley) %G% (without SMTP)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -407,56 +407,7 @@ smtp(e)
                                        printf("MAIL: got arg %s=\"%s\"\n", kp,
                                                vp == NULL ? "<null>" : vp);
 
                                        printf("MAIL: got arg %s=\"%s\"\n", kp,
                                                vp == NULL ? "<null>" : vp);
 
-                               if (strcasecmp(kp, "size") == 0)
-                               {
-                                       if (vp == NULL)
-                                       {
-                                               usrerr("501 SIZE requires a value");
-                                               /* NOTREACHED */
-                                       }
-# ifdef __STDC__
-                                       msize = strtoul(vp, (char **) NULL, 10);
-# else
-                                       msize = strtol(vp, (char **) NULL, 10);
-# endif
-                               }
-                               else if (strcasecmp(kp, "body") == 0)
-                               {
-                                       if (vp == NULL)
-                                       {
-                                               usrerr("501 BODY requires a value");
-                                               /* NOTREACHED */
-                                       }
-                                       if (strcasecmp(vp, "8bitmime") == 0)
-                                       {
-                                               SevenBitInput = FALSE;
-                                       }
-                                       else if (strcasecmp(vp, "7bit") == 0)
-                                       {
-                                               SevenBitInput = TRUE;
-                                       }
-                                       else
-                                       {
-                                               usrerr("501 Unknown BODY type %s",
-                                                       vp);
-                                               /* NOTREACHED */
-                                       }
-                                       e->e_bodytype = newstr(vp);
-                               }
-                               else if (strcasecmp(kp, "envid") == 0)
-                               {
-                                       if (vp == NULL)
-                                       {
-                                               usrerr("501 ENVID requires a value");
-                                               /* NOTREACHED */
-                                       }
-                                       e->e_envid = newstr(vp);
-                               }
-                               else
-                               {
-                                       usrerr("501 %s parameter unrecognized", kp);
-                                       /* NOTREACHED */
-                               }
+                               mail_esmtp_args(kp, vp, e);
                        }
 
                        if (MaxMessageSize > 0 && msize > MaxMessageSize)
                        }
 
                        if (MaxMessageSize > 0 && msize > MaxMessageSize)
@@ -807,6 +758,90 @@ skipword(p, w)
        return (p);
 }
 \f/*
        return (p);
 }
 \f/*
+**  MAIL_ESMTP_ARGS -- process ESMTP arguments from MAIL line
+**
+**     Parameters:
+**             kp -- the parameter key.
+**             vp -- the value of that parameter.
+**             e -- the envelope.
+**
+**     Returns:
+**             none.
+*/
+
+mail_esmtp_args(kp, vp, e)
+       char *kp;
+       char *vp;
+       ENVELOPE *e;
+{
+       if (strcasecmp(kp, "size") == 0)
+       {
+               if (vp == NULL)
+               {
+                       usrerr("501 SIZE requires a value");
+                       /* NOTREACHED */
+               }
+# ifdef __STDC__
+               msize = strtoul(vp, (char **) NULL, 10);
+# else
+               msize = strtol(vp, (char **) NULL, 10);
+# endif
+       }
+       else if (strcasecmp(kp, "body") == 0)
+       {
+               if (vp == NULL)
+               {
+                       usrerr("501 BODY requires a value");
+                       /* NOTREACHED */
+               }
+               if (strcasecmp(vp, "8bitmime") == 0)
+               {
+                       SevenBitInput = FALSE;
+               }
+               else if (strcasecmp(vp, "7bit") == 0)
+               {
+                       SevenBitInput = TRUE;
+               }
+               else
+               {
+                       usrerr("501 Unknown BODY type %s",
+                               vp);
+                       /* NOTREACHED */
+               }
+               e->e_bodytype = newstr(vp);
+       }
+       else if (strcasecmp(kp, "envid") == 0)
+       {
+               if (vp == NULL)
+               {
+                       usrerr("501 ENVID requires a value");
+                       /* NOTREACHED */
+               }
+               e->e_envid = newstr(vp);
+       }
+       else if (strcasecmp(kp, "ret") == 0)
+       {
+               if (vp == NULL)
+               {
+                       usrerr("501 RET requires a value");
+                       /* NOTREACHED */
+               }
+               e->e_flags |= EF_RET_PARAM;
+               if (strcasecmp(vp, "hdrs") == 0)
+                       e->e_flags |= EF_NO_BODY_RETN;
+               else if (strcasecmp(vp, "full") != 0)
+               {
+                       usrerr("501 Bad argument \"%s\" to RET", vp);
+                       /* NOTREACHED */
+               }
+       }
+       else
+       {
+               usrerr("501 %s parameter unrecognized", kp);
+               /* NOTREACHED */
+       }
+}
+\f/*
 **  RCPT_ESMTP_ARGS -- process ESMTP arguments from RCPT line
 **
 **     Parameters:
 **  RCPT_ESMTP_ARGS -- process ESMTP arguments from RCPT line
 **
 **     Parameters:
@@ -856,22 +891,6 @@ rcpt_esmtp_args(a, kp, vp, e)
                        }
                }
        }
                        }
                }
        }
-       else if (strcasecmp(kp, "ret") == 0)
-       {
-               if (vp == NULL)
-               {
-                       usrerr("501 RET requires a value");
-                       /* NOTREACHED */
-               }
-               a->q_flags |= QHAS_RET_PARAM;
-               if (strcasecmp(vp, "hdrs") == 0)
-                       a->q_flags |= QRET_HDRS;
-               else if (strcasecmp(vp, "full") != 0)
-               {
-                       usrerr("501 Bad argument \"%s\" to RET", vp);
-                       /* NOTREACHED */
-               }
-       }
        else if (strcasecmp(kp, "orcpt") == 0)
        {
                if (vp == NULL)
        else if (strcasecmp(kp, "orcpt") == 0)
        {
                if (vp == NULL)
index 3594529..0d10946 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef SMTP
 
 #ifndef lint
 #ifdef SMTP
-static char sccsid[] = "@(#)usersmtp.c 8.38 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 8.39 (Berkeley) %G% (with SMTP)";
 #else
 #else
-static char sccsid[] = "@(#)usersmtp.c 8.38 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 8.39 (Berkeley) %G% (without SMTP)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -218,7 +218,6 @@ tryhelo:
 \f/*
 **  ESMTP_CHECK -- check to see if this implementation likes ESMTP protocol
 **
 \f/*
 **  ESMTP_CHECK -- check to see if this implementation likes ESMTP protocol
 **
-**
 **     Parameters:
 **             line -- the response line.
 **             firstline -- set if this is the first line of the reply.
 **     Parameters:
 **             line -- the response line.
 **             firstline -- set if this is the first line of the reply.
@@ -238,14 +237,24 @@ esmtp_check(line, firstline, m, mci, e)
        register MCI *mci;
        ENVELOPE *e;
 {
        register MCI *mci;
        ENVELOPE *e;
 {
-       while ((line = strchr(++line, 'E')) != NULL)
+       register char *l;
+
+       for (l = line; (l = strchr(++l, 'E')) != NULL; )
        {
        {
-               if (strncmp(line, "ESMTP ", 6) == 0)
+               if (strncmp(l, "ESMTP ", 6) == 0)
                {
                        mci->mci_flags |= MCIF_ESMTP;
                        break;
                }
        }
                {
                        mci->mci_flags |= MCIF_ESMTP;
                        break;
                }
        }
+       for (l = line; (l = strchr(++l, '8')) != NULL; )
+       {
+               if (strncmp(l, "8BIT OK", 7) == 0)
+               {
+                       mci->mci_flags |= MCIF_8BITOK;
+                       break;
+               }
+       }
 }
 \f/*
 **  HELO_OPTIONS -- process the options on a HELO line.
 }
 \f/*
 **  HELO_OPTIONS -- process the options on a HELO line.
@@ -293,7 +302,7 @@ helo_options(line, firstline, m, mci, e)
        }
        else if (strcasecmp(line, "expn") == 0)
                mci->mci_flags |= MCIF_EXPN;
        }
        else if (strcasecmp(line, "expn") == 0)
                mci->mci_flags |= MCIF_EXPN;
-       else if (strcasecmp(line, "x-dsn-1") == 0)
+       else if (strcasecmp(line, "x-dsn-3") == 0)
                mci->mci_flags |= MCIF_DSN;
 }
 \f/*
                mci->mci_flags |= MCIF_DSN;
 }
 \f/*
@@ -366,6 +375,16 @@ smtpmailfrom(m, mci, e)
                        strcat(optbuf, " ENVID=");
                        strcat(optbuf, e->e_envid);
                }
                        strcat(optbuf, " ENVID=");
                        strcat(optbuf, e->e_envid);
                }
+
+               /* RET= parameter */
+               if (bitset(EF_RET_PARAM, e->e_flags))
+               {
+                       strcat(optbuf, " RET=");
+                       if (bitset(EF_NO_BODY_RETN, e->e_flags))
+                               strcat(optbuf, "HDRS");
+                       else
+                               strcat(optbuf, "FULL");
+               }
        }
 
        /*
        }
 
        /*
@@ -501,16 +520,6 @@ smtprcpt(to, m, mci, e)
                if (firstone)
                        strcat(optbuf, "NEVER");
 
                if (firstone)
                        strcat(optbuf, "NEVER");
 
-               /* RET= parameter */
-               if (bitset(QHAS_RET_PARAM, to->q_flags))
-               {
-                       strcat(optbuf, " RET=");
-                       if (bitset(QRET_HDRS, to->q_flags))
-                               strcat(optbuf, "HDRS");
-                       else
-                               strcat(optbuf, "FULL");
-               }
-
                /* ORCPT= parameter */
                if (to->q_orcpt != NULL)
                {
                /* ORCPT= parameter */
                if (to->q_orcpt != NULL)
                {