BSD 4_4_Lite1 release
[unix-history] / usr / src / usr.sbin / sendmail / src / savemail.c
index a695b9b..6467def 100644 (file)
@@ -3,11 +3,37 @@
  * Copyright (c) 1988, 1993
  *     The Regents of the University of California.  All rights reserved.
  *
  * Copyright (c) 1988, 1993
  *     The Regents of the University of California.  All rights reserved.
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)savemail.c 8.26 (Berkeley) %G%";
+static char sccsid[] = "@(#)savemail.c 8.28 (Berkeley) 3/11/94";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -65,8 +91,9 @@ savemail(e)
 
        if (tTd(6, 1))
        {
 
        if (tTd(6, 1))
        {
-               printf("\nsavemail, errormode = %c, id = %s\n  e_from=",
-                       e->e_errormode, e->e_id == NULL ? "NONE" : e->e_id);
+               printf("\nsavemail, errormode = %c, id = %s, ExitStat = %d\n  e_from=",
+                       e->e_errormode, e->e_id == NULL ? "NONE" : e->e_id,
+                       ExitStat);
                printaddr(&e->e_from, FALSE);
        }
 
                printaddr(&e->e_from, FALSE);
        }
 
@@ -81,10 +108,11 @@ savemail(e)
        **  to, make someone up.
        */
 
        **  to, make someone up.
        */
 
-       if (CurEnv->e_returnto == NULL)
+       if (e->e_from.q_paddr == NULL)
        {
        {
-               CurEnv->e_returnto = parse("root", (ADDRESS *) NULL, 0);
-               if (CurEnv->e_returnto == NULL)
+               e->e_sender = "Postmaster";
+               if (parseaddr(e->e_sender, &e->e_from,
+                             RF_COPYPARSE|RF_SENDERADDR, '\0', NULL, e) == NULL)
                {
                        syserr("553 Cannot parse Postmaster!");
                        ExitStat = EX_SOFTWARE;
                {
                        syserr("553 Cannot parse Postmaster!");
                        ExitStat = EX_SOFTWARE;
@@ -489,16 +517,12 @@ returntosender(msg, returnq, sendbody, e)
 
 # ifdef LOG
        if (LogLevel > 5)
 
 # ifdef LOG
        if (LogLevel > 5)
-               syslog(LOG_INFO, "%s: %s: returntosender: %s",
+               syslog(LOG_INFO, "%s: %s: return to sender: %s",
                        e->e_id, ee->e_id, msg);
 # endif
 
                        e->e_id, ee->e_id, msg);
 # endif
 
-       if (strncasecmp(msg, "warning:", 8) != 0)
-       {
-               (void) sprintf(buf, "Returned mail: %s", msg);
-               msg = buf;
-       }
-       addheader("Subject", msg, ee);
+       (void) sprintf(buf, "Returned mail: %s", msg);
+       addheader("Subject", buf, ee);
        if (SendMIMEErrors)
        {
                addheader("MIME-Version", "1.0", ee);
        if (SendMIMEErrors)
        {
                addheader("MIME-Version", "1.0", ee);
@@ -768,7 +792,7 @@ errbody(mci, e)
 pruneroute(addr)
        char *addr;
 {
 pruneroute(addr)
        char *addr;
 {
-#ifdef NAMED_BIND
+#if NAMED_BIND
        char *start, *at, *comma;
        char c;
        int rcode;
        char *start, *at, *comma;
        char c;
        int rcode;