send to dead.letter using sendto/recipient/deliver mechanism rather
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 2 Jan 1982 10:27:28 +0000 (02:27 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 2 Jan 1982 10:27:28 +0000 (02:27 -0800)
than mailfile; this fixes a bug with the "from" name and seems like
a better abstraction.

SCCS-vsn: usr.sbin/sendmail/src/savemail.c 3.25
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.71
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 3.32

usr/src/usr.sbin/sendmail/src/recipient.c
usr/src/usr.sbin/sendmail/src/savemail.c
usr/src/usr.sbin/sendmail/src/version.c

index 8f2e5c9..0cac122 100644 (file)
@@ -2,7 +2,7 @@
 # include "sendmail.h"
 # include <sys/stat.h>
 
 # include "sendmail.h"
 # include <sys/stat.h>
 
-SCCSID(@(#)recipient.c 3.31            %G%);
+SCCSID(@(#)recipient.c 3.32            %G%);
 
 /*
 **  SENDTO -- Designate a send list.
 
 /*
 **  SENDTO -- Designate a send list.
@@ -236,7 +236,7 @@ recipient(a, sendq)
                {
                        a->q_mailer = m = ProgMailer;
                        a->q_user++;
                {
                        a->q_mailer = m = ProgMailer;
                        a->q_user++;
-                       if (a->q_alias == NULL && Debug == 0 && !QueueRun)
+                       if (a->q_alias == NULL && Debug == 0 && !QueueRun && !ForceMail)
                        {
                                usrerr("Cannot mail directly to programs");
                                a->q_flags |= QDONTSEND;
                        {
                                usrerr("Cannot mail directly to programs");
                                a->q_flags |= QDONTSEND;
@@ -289,7 +289,7 @@ recipient(a, sendq)
                if (strncmp(a->q_user, ":include:", 9) == 0)
                {
                        a->q_flags |= QDONTSEND;
                if (strncmp(a->q_user, ":include:", 9) == 0)
                {
                        a->q_flags |= QDONTSEND;
-                       if (a->q_alias == NULL && Debug == 0 && !QueueRun)
+                       if (a->q_alias == NULL && Debug == 0 && !QueueRun && !ForceMail)
                                usrerr("Cannot mail directly to :include:s");
                        else
                        {
                                usrerr("Cannot mail directly to :include:s");
                        else
                        {
@@ -330,7 +330,7 @@ recipient(a, sendq)
                if ((p = rindex(buf, '/')) != NULL)
                {
                        /* check if writable or creatable */
                if ((p = rindex(buf, '/')) != NULL)
                {
                        /* check if writable or creatable */
-                       if (a->q_alias == NULL && Debug == 0 && !QueueRun)
+                       if (a->q_alias == NULL && Debug == 0 && !QueueRun && !ForceMail)
                        {
                                usrerr("Cannot mail directly to files");
                                a->q_flags |= QDONTSEND;
                        {
                                usrerr("Cannot mail directly to files");
                                a->q_flags |= QDONTSEND;
index 53710dd..1f06f7d 100644 (file)
@@ -1,7 +1,7 @@
 # include <pwd.h>
 # include "sendmail.h"
 
 # include <pwd.h>
 # include "sendmail.h"
 
-SCCSID(@(#)savemail.c  3.24            %G%);
+SCCSID(@(#)savemail.c  3.25            %G%);
 
 /*
 **  SAVEMAIL -- Save mail on error
 
 /*
 **  SAVEMAIL -- Save mail on error
@@ -36,6 +36,7 @@ savemail()
 
        if (exclusive++)
                return;
 
        if (exclusive++)
                return;
+       ForceMail = TRUE;
 
        /*
        **  In the unhappy event we don't know who to return the mail
 
        /*
        **  In the unhappy event we don't know who to return the mail
@@ -145,13 +146,16 @@ savemail()
        }
        if (p != NULL && TempFile != NULL)
        {
        }
        if (p != NULL && TempFile != NULL)
        {
+               auto ADDRESS *q;
+
                /* we have a home directory; open dead.letter */
                message(Arpa_Info, "Saving message in dead.letter");
                define('z', p);
                (void) expand("$z/dead.letter", buf, &buf[sizeof buf - 1]);
                To = buf;
                /* we have a home directory; open dead.letter */
                message(Arpa_Info, "Saving message in dead.letter");
                define('z', p);
                (void) expand("$z/dead.letter", buf, &buf[sizeof buf - 1]);
                To = buf;
-               i = mailfile(buf, &From);
-               giveresponse(i, TRUE, LocalMailer);
+               q = NULL;
+               sendto(buf, -1, NULL, &q);
+               (void) deliver(q, NULL);
        }
 
        /* add terminator to writeback message */
        }
 
        /* add terminator to writeback message */
@@ -185,7 +189,6 @@ returntosender(msg)
 
        (void) freopen("/dev/null", "w", stdout);
        NoAlias++;
 
        (void) freopen("/dev/null", "w", stdout);
        NoAlias++;
-       ForceMail++;
        ErrorMessage = msg;
 
        /* fake up an address header for the from person */
        ErrorMessage = msg;
 
        /* fake up an address header for the from person */
index c471e05..bca9274 100644 (file)
@@ -1,5 +1,5 @@
 # ifndef lint
 # ifndef lint
-static char    SccsId[] = "@(#)SendMail version 3.70 of %G%";
+static char    SccsId[] = "@(#)SendMail version 3.71 of %G%";
 # endif lint
 
 # endif lint
 
-char   Version[] = "3.70 [%G%]";
+char   Version[] = "3.71 [%G%]";