improve DSN handling somewhat + some bug fixes
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 26 Nov 1994 01:06:15 +0000 (17:06 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 26 Nov 1994 01:06:15 +0000 (17:06 -0800)
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 8.58
SCCS-vsn: usr.sbin/sendmail/src/main.c 8.70
SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 8.44
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 8.76
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 8.44
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 8.50
SCCS-vsn: usr.sbin/sendmail/src/readcf.c 8.49
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 8.114

usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/parseaddr.c
usr/src/usr.sbin/sendmail/src/readcf.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

index 1cb3935..eeb6d58 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)deliver.c  8.113 (Berkeley) %G%";
+static char sccsid[] = "@(#)deliver.c  8.114 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -2700,8 +2700,8 @@ setstatus(a, msg)
 {
        char buf[MAXLINE];
 
 {
        char buf[MAXLINE];
 
-       if (a->q_status != NULL)
-               free(a->q_status);
+       if (a->q_rstatus != NULL)
+               free(a->q_rstatus);
        if (strlen(msg) > 4)
        {
                register char *p, *q;
        if (strlen(msg) > 4)
        {
                register char *p, *q;
@@ -2732,5 +2732,5 @@ setstatus(a, msg)
                *p++ = '\0';
                msg = buf;
        }
                *p++ = '\0';
                msg = buf;
        }
-       a->q_status = newstr(msg);
+       a->q_rstatus = newstr(msg);
 }
 }
index d918d3e..e3e9cca 100644 (file)
@@ -13,7 +13,7 @@ static char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     8.69 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     8.70 (Berkeley) %G%";
 #endif /* not lint */
 
 #define        _DEFINE
 #endif /* not lint */
 
 #define        _DEFINE
@@ -846,8 +846,12 @@ main(argc, argv, envp)
                        for (j = '\0'; j <= '\177'; j++)
                                if (bitnset(j, m->m_flags))
                                        (void) putchar(j);
                        for (j = '\0'; j <= '\177'; j++)
                                if (bitnset(j, m->m_flags))
                                        (void) putchar(j);
-                       printf(" E=");
+                       printf("L=%d E=", m->m_linelimit);
                        xputs(m->m_eol);
                        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);
                        if (m->m_argv != NULL)
                        {
                                char **a = m->m_argv;
                        if (m->m_argv != NULL)
                        {
                                char **a = m->m_argv;
index 8e49927..9ef19f9 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)parseaddr.c        8.43 (Berkeley) %G%";
+static char sccsid[] = "@(#)parseaddr.c        8.44 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
index e08bb35..bcc3479 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)readcf.c   8.48 (Berkeley) %G%";
+static char sccsid[] = "@(#)readcf.c   8.49 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -815,6 +815,10 @@ makemailer(line)
                        m->m_defcharset = newstr(p);
                        break;
 
                        m->m_defcharset = newstr(p);
                        break;
 
+                 case 'T':             /* MTS Type */
+                       m->m_mtstype = newstr(p);
+                       break;
+
                  case 'U':             /* user id */
                        if (isascii(*p) && !isdigit(*p))
                        {
                  case 'U':             /* user id */
                        if (isascii(*p) && !isdigit(*p))
                        {
index 0dc8d48..5ca02df 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)recipient.c        8.57 (Berkeley) %G%";
+static char sccsid[] = "@(#)recipient.c        8.58 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -50,6 +50,7 @@ static char sccsid[] = "@(#)recipient.c       8.57 (Berkeley) %G%";
 /* q_flags bits inherited from ctladdr */
 #define QINHERITEDBITS (QPINGONSUCCESS|QPINGONFAILURE|QPINGONDELAY|QHAS_RET_PARAM|QRET_HDRS)
 
 /* q_flags bits inherited from ctladdr */
 #define QINHERITEDBITS (QPINGONSUCCESS|QPINGONFAILURE|QPINGONDELAY|QHAS_RET_PARAM|QRET_HDRS)
 
+int
 ADDRESS *
 sendto(list, copyf, ctladdr, qflags)
        char *list;
 ADDRESS *
 sendto(list, copyf, ctladdr, qflags)
        char *list;
@@ -252,7 +253,8 @@ recipient(a, sendq, aliaslevel, e)
        /* break aliasing loops */
        if (aliaslevel > MAXRCRSN)
        {
        /* break aliasing loops */
        if (aliaslevel > MAXRCRSN)
        {
-               usrerr("554 aliasing/forwarding loop broken");
+               usrerr("554 aliasing/forwarding loop broken (%d aliases deep; %d max",
+                       aliaslevel, MAXRCRSN);
                return (NULL);
        }
 
                return (NULL);
        }
 
index 7e84d37..bf76239 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)savemail.c 8.43 (Berkeley) %G%";
+static char sccsid[] = "@(#)savemail.c 8.44 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -761,9 +761,11 @@ errbody(mci, e, separator, flags)
                putline(buf, mci);
 
                /* Received-From: shows where we got this message from */
                putline(buf, mci);
 
                /* Received-From: shows where we got this message from */
-               expand("Received-From: \201_", buf, &buf[sizeof buf - 1],
-                               e->e_parent);
-               putline(buf, mci);
+               if (RealHostName != NULL)
+               {
+                       (void) sprintf(buf, "Received-From: %s", RealHostName);
+                       putline(buf, mci);
+               }
 
                /* Arrival-Date: -- when it arrived here */
                (void) sprintf(buf, "Arrival-Date: %s",
 
                /* Arrival-Date: -- when it arrived here */
                (void) sprintf(buf, "Arrival-Date: %s",
@@ -802,6 +804,8 @@ errbody(mci, e, separator, flags)
                        strcpy(buf, "Status: ");
                        if (q->q_status != NULL)
                                strcat(buf, q->q_status);
                        strcpy(buf, "Status: ");
                        if (q->q_status != NULL)
                                strcat(buf, q->q_status);
+                       else if (q->q_fstatus != NULL)
+                               strcat(buf, q->q_fstatus);
                        else if (bitset(QBADADDR, q->q_flags))
                                strcat(buf, "500");
                        else if (bitset(QQUEUEUP, q->q_flags))
                        else if (bitset(QBADADDR, q->q_flags))
                                strcat(buf, "500");
                        else if (bitset(QQUEUEUP, q->q_flags))
@@ -835,25 +839,37 @@ errbody(mci, e, separator, flags)
                                putline(buf, mci);
                        }
 
                                putline(buf, mci);
                        }
 
-                       /* Original-Rcpt: -- passed from on high */
+                       /* Original-Recipient: -- passed from on high */
                        if (q->q_orcpt != NULL)
                        {
                        if (q->q_orcpt != NULL)
                        {
-                               (void) sprintf(buf, "Original-Rcpt: %s",
+                               (void) sprintf(buf, "Original-Recipient: %s",
                                        q->q_orcpt);
                                putline(buf, mci);
                        }
 
                                        q->q_orcpt);
                                putline(buf, mci);
                        }
 
-                       /* Final-Rcpt: -- if through alias */
+                       /* Final-Recipient: -- if through alias */
                        if (q->q_alias != NULL)
                        {
                        if (q->q_alias != NULL)
                        {
-                               (void) sprintf(buf, "Final-Rcpt: %s",
+                               (void) sprintf(buf, "Final-Recipient: %s",
                                        q->q_paddr);
                                putline(buf, mci);
                        }
 
                        /* Final-Status: -- same as Status?  XXX */
                                        q->q_paddr);
                                putline(buf, mci);
                        }
 
                        /* Final-Status: -- same as Status?  XXX */
+                       if (q->q_fstatus != NULL && q->q_status != NULL)
+                       {
+                               (void) sprintf(buf, "Final-Status: %s",
+                                       q->q_fstatus);
+                               putline(buf, mci);
+                       }
 
                        /* Remote-MTS-Type: -- always INET?  XXX */
 
                        /* Remote-MTS-Type: -- always INET?  XXX */
+                       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)
 
                        /* Remote-MTA: -- who was I talking to? */
                        if (q->q_statmta != NULL)
@@ -863,9 +879,21 @@ errbody(mci, e, separator, flags)
                                putline(buf, mci);
                        }
 
                                putline(buf, mci);
                        }
 
-                       /* Remote-Rcpt: -- same as Final-Rcpt?  XXX */
+                       /* Remote-Recipient: -- same as Final-Recipient?  XXX */
+                       if (strcmp(q->q_user, q->q_paddr) != 0)
+                       {
+                               (void) sprintf(buf, "Remote-Recipient: %s",
+                                       q->q_user);
+                               putline(buf, mci);
+                       }
 
 
-                       /* Remote-Status: -- same as Final-Status?  XXX */
+                       /* Remote-Status: -- return code from remote mailer */
+                       if (q->q_rstatus != NULL)
+                       {
+                               (void) sprintf(buf, "Remote-Status: %s",
+                                       q->q_rstatus);
+                               putline(buf, mci);
+                       }
                }
        }
 
                }
        }
 
index 061e056..53afbde 100644 (file)
@@ -5,7 +5,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)sendmail.h  8.75 (Berkeley) %G%
+ *     @(#)sendmail.h  8.76 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -15,7 +15,7 @@
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
-static char SmailSccsId[] =    "@(#)sendmail.h 8.75            %G%";
+static char SmailSccsId[] =    "@(#)sendmail.h 8.76            %G%";
 # endif
 # else /*  _DEFINE */
 # define EXTERN extern
 # endif
 # else /*  _DEFINE */
 # define EXTERN extern
@@ -163,6 +163,7 @@ struct mailer
 {
        char    *m_name;        /* symbolic name of this mailer */
        char    *m_mailer;      /* pathname of the mailer to use */
 {
        char    *m_name;        /* symbolic name of this mailer */
        char    *m_mailer;      /* pathname of the mailer to use */
+       char    *m_mtstype;     /* type of this MTS */
        BITMAP  m_flags;        /* status flags, see below */
        short   m_mno;          /* mailer number internally */
        char    **m_argv;       /* template argument vector */
        BITMAP  m_flags;        /* status flags, see below */
        short   m_mno;          /* mailer number internally */
        char    **m_argv;       /* template argument vector */
@@ -1048,6 +1049,7 @@ extern void               commaize __P((HDR *, char *, int, MCI *, ENVELOPE *));
 extern char            *hvalue __P((char *, HDR *));
 extern char            *defcharset __P((ENVELOPE *));
 extern bool            emptyaddr __P((ADDRESS *));
 extern char            *hvalue __P((char *, HDR *));
 extern char            *defcharset __P((ENVELOPE *));
 extern bool            emptyaddr __P((ADDRESS *));
+extern int             sendtolist __P((char *, ADDRESS *, ADDRESS **, int, ENVELOPE *));
 
 /* ellipsis is a different case though */
 #ifdef __STDC__
 
 /* ellipsis is a different case though */
 #ifdef __STDC__
index 9c7edb7..cb51cf5 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef SMTP
 
 #ifndef lint
 #ifdef SMTP
-static char sccsid[] = "@(#)srvrsmtp.c 8.49 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.50 (Berkeley) %G% (with SMTP)";
 #else
 #else
-static char sccsid[] = "@(#)srvrsmtp.c 8.49 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.50 (Berkeley) %G% (without SMTP)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */