cut at 20 January version of DSN document
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 6 Feb 1995 00:04:07 +0000 (16:04 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 6 Feb 1995 00:04:07 +0000 (16:04 -0800)
SCCS-vsn: usr.sbin/sendmail/src/usersmtp.c 8.34
SCCS-vsn: usr.sbin/sendmail/src/headers.c 8.46
SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 8.49
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 8.83
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 8.51
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 8.53
SCCS-vsn: usr.sbin/sendmail/src/readcf.c 8.61
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 8.120
SCCS-vsn: usr.sbin/sendmail/src/queue.c 8.61

usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/headers.c
usr/src/usr.sbin/sendmail/src/parseaddr.c
usr/src/usr.sbin/sendmail/src/queue.c
usr/src/usr.sbin/sendmail/src/readcf.c
usr/src/usr.sbin/sendmail/src/savemail.c
usr/src/usr.sbin/sendmail/src/sendmail.h
usr/src/usr.sbin/sendmail/src/srvrsmtp.c
usr/src/usr.sbin/sendmail/src/usersmtp.c

index 0ab60d2..f001110 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)deliver.c  8.119 (Berkeley) %G%";
+static char sccsid[] = "@(#)deliver.c  8.120 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -1482,8 +1482,8 @@ tryhost:
                */
 
                putfromline(mci, e);
-               (*e->e_puthdr)(mci, e->e_header, e, 0);
-               (*e->e_putbody)(mci, e, NULL, 0);
+               (*e->e_puthdr)(mci, e->e_header, e);
+               (*e->e_putbody)(mci, e, NULL);
 
                /* get the exit status */
                rcode = endmailer(mci, e, pv);
@@ -2205,7 +2205,6 @@ 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.
-**             flags -- to modify the behaviour.
 **
 **     Returns:
 **             none.
@@ -2219,11 +2218,10 @@ putfromline(mci, e)
 #define OS_CR          1       /* read a carriage return */
 #define OS_INLINE      2       /* putting rest of line */
 
-putbody(mci, e, separator, flags)
+putbody(mci, e, separator)
        register MCI *mci;
        register ENVELOPE *e;
        char *separator;
-       int flags;
 {
        char buf[MAXLINE];
 
@@ -2595,8 +2593,8 @@ mailfile(filename, ctladdr, e)
                        mcibuf.mci_flags |= MCIF_7BIT;
 
                putfromline(&mcibuf, e);
-               (*e->e_puthdr)(&mcibuf, e->e_header, e, 0);
-               (*e->e_putbody)(&mcibuf, e, NULL, 0);
+               (*e->e_puthdr)(&mcibuf, e->e_header, e);
+               (*e->e_putbody)(&mcibuf, e, NULL);
                putline("\n", &mcibuf);
                if (ferror(f))
                {
index 75f3505..e01a0a1 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)headers.c  8.45 (Berkeley) %G%";
+static char sccsid[] = "@(#)headers.c  8.46 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <errno.h>
@@ -924,7 +924,6 @@ crackaddr(addr)
 **             mci -- the connection information.
 **             h -- the header to put.
 **             e -- envelope to use.
-**             flags -- to modify the behaviour.
 **
 **     Returns:
 **             none.
@@ -940,11 +939,10 @@ crackaddr(addr)
 # define MAX(a,b) (((a)>(b))?(a):(b))
 #endif
 
-putheader(mci, h, e, flags)
+putheader(mci, h, e)
        register MCI *mci;
        register HDR *h;
        register ENVELOPE *e;
-       int flags;
 {
        char buf[MAX(MAXLINE,BUFSIZ)];
        char obuf[MAXLINE];
@@ -990,19 +988,9 @@ putheader(mci, h, e, flags)
                        continue;
                }
 
-               /* suppress Content-Type: if we are not including the body */
-               if (bitset(PF_DELETEMIMEHDRS, 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) &&
-                   (bitset(MCIF_CVT8TO7, mci->mci_flags) ||
-                    bitset(PF_DELETEMIMEHDRS, flags)))
+                   bitset(MCIF_CVT8TO7, mci->mci_flags))
                {
                        if (tTd(34, 11))
                                printf(" (skipped (content-transfer-encoding))\n");
index dacdbcf..2e2ecfc 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)parseaddr.c        8.48 (Berkeley) %G%";
+static char sccsid[] = "@(#)parseaddr.c        8.49 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
index 278689d..9185011 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef QUEUE
-static char sccsid[] = "@(#)queue.c    8.60 (Berkeley) %G% (with queueing)";
+static char sccsid[] = "@(#)queue.c    8.61 (Berkeley) %G% (with queueing)";
 #else
-static char sccsid[] = "@(#)queue.c    8.60 (Berkeley) %G% (without queueing)";
+static char sccsid[] = "@(#)queue.c    8.61 (Berkeley) %G% (without queueing)";
 #endif
 #endif /* not lint */
 
@@ -177,7 +177,7 @@ queueup(e, queueall, announce)
                bzero(&mcibuf, sizeof mcibuf);
                mcibuf.mci_out = dfp;
                mcibuf.mci_mailer = FileMailer;
-               (*e->e_putbody)(&mcibuf, e, NULL, 0);
+               (*e->e_putbody)(&mcibuf, e, NULL);
                (void) xfclose(dfp, "queueup dfp", e->e_id);
                e->e_putbody = putbody;
        }
@@ -248,8 +248,6 @@ queueup(e, queueall, announce)
        /* output ESMTP-supplied "original" information */
        if (e->e_envid != NULL)
                fprintf(tfp, "Z%s\n", e->e_envid);
-       if (e->e_omts != NULL)
-               fprintf(tfp, "O%s\n", e->e_omts);
 
        /* output list of error recipients */
        printctladdr(NULL, NULL);
@@ -1398,10 +1396,6 @@ readqf(e)
                        }
                        break;
 
-                 case 'O':             /* original MTS from ESMTP */
-                       e->e_omts = newstr(&bp[1]);
-                       break;
-
                  case 'Z':             /* original envelope id from ESMTP */
                        e->e_envid = newstr(&bp[1]);
                        break;
index 08fb933..512a78c 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)readcf.c   8.60 (Berkeley) %G%";
+static char sccsid[] = "@(#)readcf.c   8.61 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -836,8 +836,32 @@ makemailer(line)
                        m->m_defcharset = newstr(p);
                        break;
 
-                 case 'T':             /* MTS Type */
-                       m->m_mtstype = newstr(p);
+                 case 'T':             /* MTA Type */
+                       m->m_mtatype = newstr(p);
+                       p = strchr(m->m_mtatype, '/');
+                       if (p != NULL)
+                       {
+                               *p++ = '\0';
+                               if (*p == '\0')
+                                       p = NULL;
+                       }
+                       if (p == NULL)
+                               m->m_addrtype = m->m_mtatype;
+                       else
+                       {
+                               m->m_addrtype = p;
+                               p = strchr(p, '/');
+                       }
+                       if (p != NULL)
+                       {
+                               *p++ = '\0';
+                               if (*p == '\0')
+                                       p = NULL;
+                       }
+                       if (p == NULL)
+                               m->m_diagtype = m->m_mtatype;
+                       else
+                               m->m_diagtype = p;
                        break;
 
                  case 'U':             /* user id */
@@ -923,10 +947,17 @@ makemailer(line)
                        setbitn(M_7BITS, m->m_flags);
        }
 
-       if (ConfigLevel < 6 && m->m_mtstype == NULL &&
+       if (ConfigLevel < 6 &&
            (strcmp(m->m_mailer, "[IPC]") == 0 ||
             strcmp(m->m_mailer, "[TCP]") == 0))
-               m->m_mtstype = "Internet";
+       {
+               if (m->m_mtatype == NULL)
+                       m->m_mtatype = "dns";
+               if (m->m_addrtype == NULL)
+                       m->m_addrtype = "rfc822";
+               if (m->m_diagtype == NULL)
+                       m->m_diagtype = "smtp";
+       }
 
        /* enter the mailer into the symbol table */
        s = stab(m->m_name, ST_MAILER, ST_ENTER);
@@ -1109,8 +1140,10 @@ printmailer(m)
        xputs(m->m_eol);
        if (m->m_defcharset != NULL)
                printf(" C=%s", m->m_defcharset);
-       if (m->m_mtstype != NULL)
-               printf(" T=%s", m->m_mtstype);
+       printf(" T=%s/%s/%s",
+               m->m_mtatype == NULL ? "<undefined>" : m->m_mtatype,
+               m->m_addrtype == NULL ? "<undefined>" : m->m_addrtype,
+               m->m_diagtype == NULL ? "<undefined>" : m->m_diagtype);
        if (m->m_argv != NULL)
        {
                char **a = m->m_argv;
index ed8aeb7..023866a 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)savemail.c 8.50 (Berkeley) %G%";
+static char sccsid[] = "@(#)savemail.c 8.51 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -377,8 +377,8 @@ savemail(e, sendbody)
                                mcibuf.mci_flags |= MCIF_7BIT;
 
                        putfromline(&mcibuf, e);
-                       (*e->e_puthdr)(&mcibuf, e->e_header, e, 0);
-                       (*e->e_putbody)(&mcibuf, e, NULL, 0);
+                       (*e->e_puthdr)(&mcibuf, e->e_header, e);
+                       (*e->e_putbody)(&mcibuf, e, NULL);
                        putline("\n", &mcibuf);
                        (void) fflush(fp);
                        state = ferror(fp) ? ESM_PANIC : ESM_DONE;
@@ -433,6 +433,7 @@ returntosender(msg, returnq, sendbody, e)
        ENVELOPE errenvelope;
        static int returndepth;
        register ADDRESS *q;
+       char *p;
 
        if (returnq == NULL)
                return (-1);
@@ -568,7 +569,7 @@ returntosender(msg, returnq, sendbody, e)
 **             Outputs the body of an error message.
 */
 
-errbody(mci, e, separator, flags)
+errbody(mci, e, separator)
        register MCI *mci;
        register ENVELOPE *e;
        char *separator;
@@ -577,8 +578,8 @@ errbody(mci, e, separator, flags)
        char *p;
        register ADDRESS *q;
        bool printheader;
-       int pflags = flags;
        char buf[MAXLINE];
+       extern char *xtextify();
 
        if (bitset(MCIF_INHEADER, mci->mci_flags))
        {
@@ -729,47 +730,37 @@ errbody(mci, e, separator, flags)
                putline("", mci);
                (void) sprintf(buf, "--%s", e->e_msgboundary);
                putline(buf, mci);
-               putline("Content-Type: message/X-delivery-status-1", mci);
+               putline("Content-Type: message/X-delivery-status-2 (Draft of 20 January 1995)", mci);
                putline("", mci);
 
                /*
                **  Output per-message information.
                */
 
-               /* OMTS from MAIL FROM: line */
-               if (e->e_parent->e_omts != NULL)
-               {
-                       (void) sprintf(buf, "Original-MTS-Type: %s",
-                               e->e_parent->e_omts);
-                       putline(buf, mci);
-               }
-
                /* original envelope id from MAIL FROM: line */
                if (e->e_parent->e_envid != NULL)
                {
                        (void) sprintf(buf, "Original-Envelope-Id: %s",
-                               e->e_parent->e_envid);
+                               xtextify(e->e_parent->e_envid));
                        putline(buf, mci);
                }
 
-               /* Final-MTS-Type: is required -- our type */
-               if (e->e_parent->e_from.q_mailer->m_mtstype == NULL)
-                       putline("Final-MTS-Type: Internet", mci);
-               else
-               {
-                       (void) sprintf(buf, "Final-MTS-Type: %s",
-                               e->e_parent->e_from.q_mailer->m_mtstype);
-                       putline(buf, mci);
-               }
-
-               /* Final-MTA: seems silly -- this is in the From: line */
-               (void) sprintf(buf, "Final-MTA: %s", MyHostName);
+               /* Reporting-MTA: is us (required) */
+               p = e->e_parent->e_from.q_mailer->m_mtatype;
+               if (p == NULL)
+                       p = "dns";
+               (void) sprintf(buf, "Reporting-MTA: %s; %s", p, MyHostName);
                putline(buf, mci);
 
-               /* Received-From: shows where we got this message from */
+               /* Received-From-MTA: shows where we got this message from */
                if (RealHostName != NULL)
                {
-                       (void) sprintf(buf, "Received-From: %s", RealHostName);
+                       /* XXX use $s for type? */
+                       p = e->e_parent->e_from.q_mailer->m_mtatype;
+                       if (p == NULL)
+                               p = "dns";
+                       (void) sprintf(buf, "Received-From-MTA: %s; %s",
+                               p, RealHostName);
                        putline(buf, mci);
                }
 
@@ -790,22 +781,31 @@ errbody(mci, e, separator, flags)
                                continue;
                        putline("", mci);
 
-                       /* Recipient: -- use name of alias */
-                       r = q;
-                       if (r->q_alias != NULL)
-                               r = r->q_alias;
-                       p = r->q_user;
-                       if (strchr(p, '@') == NULL)
-                               (void) sprintf(buf, "Recipient: %s@%s",
-                                       p, MyHostName);
+                       /* Original-Recipient: -- passed from on high */
+                       if (q->q_orcpt != NULL)
+                       {
+                               (void) sprintf(buf, "Original-Recipient: %s",
+                                       xtextify(q->q_orcpt));
+                               putline(buf, mci);
+                       }
+
+                       /* Final-Recipient: -- the name from the RCPT command */
+                       p = e->e_parent->e_from.q_mailer->m_addrtype;
+                       if (p == NULL)
+                               p = "rfc822";
+                       for (r = q; r->q_alias != NULL; r = r->q_alias)
+                               continue;
+                       if (strchr(r->q_user, '@') == NULL)
+                               (void) sprintf(buf, "Final-Recipient: %s; %s@%s",
+                                       p, xtextify(r->q_user), MyHostName);
                        else
-                               (void) sprintf(buf, "Recipient: %s",
-                                       p);
+                               (void) sprintf(buf, "Final-Recipient: %s; %s",
+                                       p, xtextify(r->q_user));
                        putline(buf, mci);
 
                        /* Action: -- what happened? */
                        if (bitset(QBADADDR, q->q_flags))
-                               putline("Action: failed", mci);
+                               putline("Action: failure", mci);
                        else if (bitset(QQUEUEUP, q->q_flags))
                                putline("Action: delayed", mci);
                        else if (bitset(QRELAYED, q->q_flags))
@@ -815,31 +815,56 @@ errbody(mci, e, separator, flags)
 
                        /* Status: -- what _really_ happened? */
                        strcpy(buf, "Status: ");
-                       if (q->q_status == NULL)
-                               q->q_status = q->q_fstatus;
                        if (q->q_status != NULL)
                                strcat(buf, q->q_status);
                        else if (bitset(QBADADDR, q->q_flags))
-                               strcat(buf, "500");
+                               strcat(buf, "5.0.0");
                        else if (bitset(QQUEUEUP, q->q_flags))
-                               strcat(buf, "400");
+                               strcat(buf, "4.0.0");
                        else if (bitset(QRELAYED, q->q_flags))
-                               strcat(buf, "601");
+                               strcat(buf, "6.0.1");
                        else
-                               strcat(buf, "200");
+                               strcat(buf, "2.0.0");
                        putline(buf, mci);
 
-                       /* Date: -- fine granularity */
+                       /* Remote-MTA: -- who was I talking to? */
+                       p = q->q_mailer->m_mtatype;
+                       if (p == NULL)
+                               p = "dns";
+                       (void) sprintf(buf, "Remote-MTA: %s; ", p);
+                       if (q->q_statmta != NULL)
+                               p = q->q_statmta;
+                       else if (q->q_host != NULL)
+                               p = q->q_host;
+                       else
+                               p = NULL;
+                       if (p != NULL)
+                       {
+                               strcat(buf, p);
+                               p = &buf[strlen(buf) - 1];
+                               if (*p == '.')
+                                       *p = '\0';
+                               putline(buf, mci);
+                       }
+
+                       /* Diagnostic-Code: -- actual result from other end */
+                       if (q->q_rstatus != NULL)
+                       {
+                               p = q->q_mailer->m_diagtype;
+                               if (p == NULL)
+                                       p = "smtp";
+                               (void) sprintf(buf, "Diagnostic-Code: %s; %s",
+                                       p, q->q_rstatus);
+                               putline(buf, mci);
+                       }
+
+                       /* Last-Attempt-Date: -- fine granularity */
                        if (q->q_statdate == (time_t) 0L)
                                q->q_statdate = curtime();
-                       (void) sprintf(buf, "Date: %s",
+                       (void) sprintf(buf, "Last-Attempt-Date: %s",
                                arpadate(ctime(&q->q_statdate)));
                        putline(buf, mci);
 
-                       /* Final-Log-Id: -- why isn't this per-message? */
-                       (void) sprintf(buf, "Final-Log-Id: %s", e->e_id);
-                       putline(buf, mci);
-
                        /* Expiry-Date: -- for delayed messages only */
                        if (bitset(QQUEUEUP, q->q_flags) &&
                            !bitset(QBADADDR, q->q_flags))
@@ -851,71 +876,6 @@ errbody(mci, e, separator, flags)
                                        arpadate(ctime(&xdate)));
                                putline(buf, mci);
                        }
-
-                       /* Original-Recipient: -- passed from on high */
-                       if (q->q_orcpt != NULL)
-                       {
-                               (void) sprintf(buf, "Original-Recipient: %s",
-                                       q->q_orcpt);
-                               putline(buf, mci);
-                       }
-
-                       /* Final-Recipient: -- the name from the RCPT command */
-                       for (r = q; r->q_alias != NULL; r = r->q_alias)
-                               continue;
-                       if (strchr(r->q_user, '@') == NULL)
-                               (void) sprintf(buf, "Final-Recipient: %s@%s",
-                                       r->q_user, MyHostName);
-                       else
-                               (void) sprintf(buf, "Final-Recipient: %s",
-                                       r->q_user);
-                       putline(buf, mci);
-
-                       /* Final-Status: -- same as Status?  XXX */
-                       if (q->q_fstatus != NULL && q->q_fstatus != q->q_status)
-                       {
-                               (void) sprintf(buf, "Final-Status: %s",
-                                       q->q_fstatus);
-                               putline(buf, mci);
-                       }
-
-                       /* Remote-MTS-Type: -- depends on mailer */
-                       if (q->q_mailer->m_mtstype != NULL)
-                       {
-                               (void) sprintf(buf, "Remote-MTS-Type: %s",
-                                       q->q_mailer->m_mtstype);
-                               putline(buf, mci);
-                       }
-
-                       /* Remote-MTA: -- who was I talking to? */
-                       if (q->q_statmta != NULL)
-                       {
-                               (void) sprintf(buf, "Remote-MTA: %s",
-                                       q->q_statmta);
-                               putline(buf, mci);
-                       }
-                       else if (q->q_host != NULL)
-                       {
-                               (void) sprintf(buf, "Remote-MTA: %s",
-                                       q->q_host);
-                               putline(buf, mci);
-                       }
-
-                       /* Remote-Recipient: -- recipient passed to far end */
-                       if (strcmp(q->q_user, r->q_paddr) != 0)
-                       {
-                               (void) sprintf(buf, "Remote-Recipient: %s",
-                                       q->q_user);
-                               putline(buf, mci);
-                       }
-
-                       /* Remote-Status: -- return code from remote mailer */
-                       if (q->q_rstatus != NULL)
-                       {
-                               (void) sprintf(buf, "Remote-Status: %s",
-                                       q->q_rstatus);
-                               putline(buf, mci);
-                       }
                }
        }
 #endif
@@ -926,8 +886,6 @@ errbody(mci, e, separator, flags)
 
        if (bitset(EF_NORETURN, e->e_parent->e_flags))
                SendBody = FALSE;
-       if (!SendBody && e->e_msgboundary != NULL)
-               pflags |= PF_DELETEMIMEHDRS;
        putline("", mci);
        if (e->e_parent->e_df != NULL)
        {
@@ -943,19 +901,21 @@ errbody(mci, e, separator, flags)
                {
                        (void) sprintf(buf, "--%s", e->e_msgboundary);
                        putline(buf, mci);
-                       putline("Content-Type: message/rfc822", mci);
+                       (void) sprintf(buf, "Content-Type: message/rfc822%s",
+                               mci, SendBody ? "" : "-headers");
+                       putline(buf, mci);
                }
                putline("", mci);
-               putheader(mci, e->e_parent->e_header, e->e_parent, pflags);
+               putheader(mci, e->e_parent->e_header, e->e_parent);
                if (SendBody)
-                       putbody(mci, e->e_parent, e->e_msgboundary, pflags);
-               else
+                       putbody(mci, e->e_parent, e->e_msgboundary);
+               else if (e->e_msgboundary == NULL)
                {
                        putline("", mci);
                        putline("   ----- Message body suppressed -----", mci);
                }
        }
-       else
+       else if (e->e_msgboundary == NULL)
        {
                putline("  ----- No message was collected -----\n", mci);
        }
@@ -976,6 +936,130 @@ errbody(mci, e, separator, flags)
                syserr("errbody: I/O error");
 }
 \f/*
+**  SMTPTODSN -- convert SMTP to DSN status code
+**
+**     Parameters:
+**             smtpstat -- the smtp status code (e.g., 550).
+**
+**     Returns:
+**             The DSN version of the status code.
+*/
+
+char *
+smtptodsn(smtpstat)
+       int smtpstat;
+{
+       switch (smtpstat)
+       {
+         case 450:     /* Req mail action not taken: mailbox unavailable */
+               return "4.2.0";
+
+         case 451:     /* Req action aborted: local error in processing */
+               return "4.3.0";
+
+         case 452:     /* Req action not taken: insufficient sys storage */
+               return "4.3.1";
+
+         case 500:     /* Syntax error, command unrecognized */
+               return "5.5.2";
+
+         case 501:     /* Syntax error in parameters or arguments */
+               return "5.5.4";
+
+         case 502:     /* Command not implemented */
+               return "5.5.1";
+
+         case 503:     /* Bad sequence of commands */
+               return "5.5.1";
+
+         case 504:     /* Command parameter not implemented */
+               return "5.5.4";
+
+         case 550:     /* Req mail action not taken: mailbox unavailable */
+               return "5.2.0";
+
+         case 551:     /* User not local; please try <...> */
+               return "5.1.6";
+
+         case 552:     /* Req mail action aborted: exceeded storage alloc */
+               return "5.2.2";
+
+         case 553:     /* Req action not taken: mailbox name not allowed */
+               return "5.1.3";
+
+         case 554:     /* Transaction failed */
+               return "5.0.0";
+       }
+
+       if ((smtpstat / 100) == 2)
+               return "2.0.0";
+       if ((smtpstat / 100) == 4)
+               return "4.0.0";
+       return "5.0.0";
+}
+\f/*
+**  XTEXTIFY -- take regular text and turn it into DSN-style xtext
+**
+**     Parameters:
+**             t -- the text to convert.
+**
+**     Returns:
+**             The xtext-ified version of the same string.
+*/
+
+char *
+xtextify(t)
+       register char *t;
+{
+       register char *p;
+       int l;
+       int nbogus;
+       static char *bp = NULL;
+       static int bplen = 0;
+
+       /* figure out how long this xtext will have to be */
+       nbogus = l = 0;
+       for (p = t; *p != '\0'; p++)
+       {
+               register int c = (*p & 0xff);
+
+               /* ASCII dependence here -- this is the way the spec words it */
+               if (c < '!' || c > '~' || c == '+' || c == '\\' || c == '(')
+                       nbogus++;
+               l++;
+       }
+       if (nbogus == 0)
+               return t;
+       l += nbogus * 2 + 1;
+
+       /* now allocate space if necessary for the new string */
+       if (l > bplen)
+       {
+               if (bp != NULL)
+                       free(bp);
+               bp = xalloc(l);
+               bplen = l;
+       }
+
+       /* ok, copy the text with byte expansion */
+       for (p = bp; *t != '\0'; )
+       {
+               register int c = (*t++ & 0xff);
+
+               /* ASCII dependence here -- this is the way the spec words it */
+               if (c < '!' || c > '~' || c == '+' || c == '\\' || c == '(')
+               {
+                       *p++ = '+';
+                       *p++ = "0123456789abcdef"[c >> 4];
+                       *p++ = "0123456789abcdef"[c & 0xf];
+               }
+               else
+                       *p++ = c;
+       }
+       *p = '\0';
+       return bp;
+}
+\f/*
 **  PRUNEROUTE -- prune an RFC-822 source route
 ** 
 **     Trims down a source route to the last internet-registered hop.
index 4308489..24644e9 100644 (file)
@@ -5,7 +5,7 @@
  *
  * %sccs.include.redist.c%
  *
- *     @(#)sendmail.h  8.82 (Berkeley) %G%
+ *     @(#)sendmail.h  8.83 (Berkeley) %G%
  */
 
 /*
@@ -15,7 +15,7 @@
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
-static char SmailSccsId[] =    "@(#)sendmail.h 8.82            %G%";
+static char SmailSccsId[] =    "@(#)sendmail.h 8.83            %G%";
 # endif
 # else /*  _DEFINE */
 # define EXTERN extern
@@ -163,7 +163,9 @@ struct mailer
 {
        char    *m_name;        /* symbolic name of this mailer */
        char    *m_mailer;      /* pathname of the mailer to use */
-       char    *m_mtstype;     /* type of this MTS */
+       char    *m_mtatype;     /* type of this MTA */
+       char    *m_addrtype;    /* type for addresses */
+       char    *m_diagtype;    /* type for diagnostics */
        BITMAP  m_flags;        /* status flags, see below */
        short   m_mno;          /* mailer number internally */
        char    **m_argv;       /* template argument vector */
@@ -377,7 +379,6 @@ ENVELOPE
        char            *e_msgboundary; /* MIME-style message part boundary */
        char            *e_origrcpt;    /* original recipient (one only) */
        char            *e_envid;       /* envelope id from MAIL FROM: line */
-       char            *e_omts;        /* OMTS parameter from MAIL FROM: */
        time_t          e_dtime;        /* time of last delivery attempt */
        int             e_ntries;       /* number of delivery attempts */
        dev_t           e_dfdev;        /* df file's device, for crash recov */
index 3b844ed..44a521b 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef SMTP
-static char sccsid[] = "@(#)srvrsmtp.c 8.52 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.53 (Berkeley) %G% (with SMTP)";
 #else
-static char sccsid[] = "@(#)srvrsmtp.c 8.52 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.53 (Berkeley) %G% (without SMTP)";
 #endif
 #endif /* not lint */
 
@@ -452,15 +452,6 @@ smtp(e)
                                        }
                                        e->e_envid = newstr(vp);
                                }
-                               else if (strcasecmp(kp, "omts") == 0)
-                               {
-                                       if (vp == NULL)
-                                       {
-                                               usrerr("501 OMTS requires a value");
-                                               /* NOTREACHED */
-                                       }
-                                       e->e_omts = newstr(vp);
-                               }
                                else
                                {
                                        usrerr("501 %s parameter unrecognized", kp);
index 099544e..7353aa6 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef SMTP
-static char sccsid[] = "@(#)usersmtp.c 8.33 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 8.34 (Berkeley) %G% (with SMTP)";
 #else
-static char sccsid[] = "@(#)usersmtp.c 8.33 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 8.34 (Berkeley) %G% (without SMTP)";
 #endif
 #endif /* not lint */
 
@@ -366,11 +366,6 @@ smtpmailfrom(m, mci, e)
                        strcat(optbuf, " ENVID=");
                        strcat(optbuf, e->e_envid);
                }
-               if (e->e_omts != NULL)
-               {
-                       strcat(optbuf, " OMTS=");
-                       strcat(optbuf, e->e_omts);
-               }
        }
 
        /*
@@ -643,8 +638,8 @@ smtpdata(m, mci, e)
        **  Output the actual message.
        */
 
-       (*e->e_puthdr)(mci, e->e_header, e, 0);
-       (*e->e_putbody)(mci, e, NULL, 0);
+       (*e->e_puthdr)(mci, e->e_header, e);
+       (*e->e_putbody)(mci, e, NULL);
 
        /*
        **  Cleanup after sending message.