better error message handling: don't create bogus return messages;
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 18 Jul 1993 04:49:22 +0000 (20:49 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 18 Jul 1993 04:49:22 +0000 (20:49 -0800)
print both actual address and q_alias whereever possible

SCCS-vsn: usr.sbin/sendmail/src/envelope.c 8.5
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 8.5

usr/src/usr.sbin/sendmail/src/envelope.c
usr/src/usr.sbin/sendmail/src/savemail.c

index eb9f510..544bafb 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)envelope.c 8.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)envelope.c 8.5 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -120,7 +120,6 @@ dropenvelope(e)
                            strcmp(e->e_from.q_paddr, "<>") != 0)
                                (void) sendtolist(e->e_from.q_paddr, NULL,
                                                  &e->e_errorqueue, e);
                            strcmp(e->e_from.q_paddr, "<>") != 0)
                                (void) sendtolist(e->e_from.q_paddr, NULL,
                                                  &e->e_errorqueue, e);
-                       saveit = TRUE;
                }
        }
 
                }
        }
 
@@ -197,6 +196,19 @@ dropenvelope(e)
        if (saveit && e->e_errormode != EM_QUIET)
                savemail(e);
 
        if (saveit && e->e_errormode != EM_QUIET)
                savemail(e);
 
+       /*
+       **  Arrange to send warning messages to postmaster as requested.
+       */
+
+       if (bitset(EF_PM_NOTIFY, e->e_flags) && PostMasterCopy != NULL &&
+           !bitset(EF_RESPONSE, e->e_flags))
+       {
+               auto ADDRESS *rlist = NULL;
+
+               (void) sendtolist(PostMasterCopy, (ADDRESS *) NULL, &rlist, e);
+               (void) returntosender(e->e_message, rlist, FALSE, e);
+       }
+
        /*
        **  Instantiate or deinstantiate the queue.
        */
        /*
        **  Instantiate or deinstantiate the queue.
        */
index 947945d..5f2d03b 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)savemail.c 8.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)savemail.c 8.5 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <pwd.h>
 #endif /* not lint */
 
 # include <pwd.h>
@@ -242,16 +242,7 @@ savemail(e)
                        **  You really shouldn't need this.
                        */
 
                        **  You really shouldn't need this.
                        */
 
-                       if (PostMasterCopy != NULL)
-                       {
-                               auto ADDRESS *rlist = NULL;
-
-                               (void) sendtolist(PostMasterCopy,
-                                                 (ADDRESS *) NULL,
-                                                 &rlist, e);
-                               (void) returntosender(e->e_message,
-                                                     rlist, FALSE, e);
-                       }
+                       e->e_flags |= EF_PM_NOTIFY;
 
                        q = e->e_errorqueue;
                        if (q == NULL)
 
                        q = e->e_errorqueue;
                        if (q == NULL)
@@ -617,15 +608,19 @@ errbody(fp, m, e)
                                        fp, m);
                                printheader = FALSE;
                        }
                                        fp, m);
                                printheader = FALSE;
                        }
-                       if (q->q_alias != NULL)
-                               strcpy(buf, q->q_alias->q_paddr);
-                       else
-                               strcpy(buf, q->q_paddr);
+                       strcpy(buf, q->q_paddr);
                        if (bitset(QBADADDR, q->q_flags))
                        if (bitset(QBADADDR, q->q_flags))
-                               strcat(buf, "  (hard error -- address deleted)");
+                               strcat(buf, "  (unrecoverable error)");
                        else
                        else
-                               strcat(buf, "  (temporary failure -- will retry)");
+                               strcat(buf, "  (transient failure)");
                        putline(buf, fp, m);
                        putline(buf, fp, m);
+                       if (q->q_alias != NULL)
+                       {
+                               strcpy(buf, "    (expanded from: ");
+                               strcat(buf, q->q_alias->q_paddr);
+                               strcat(buf, ")");
+                               putline(buf, fp, m);
+                       }
                }
        }
        if (!printheader)
                }
        }
        if (!printheader)