From 78bbbc481dbbd519f5fd31c14e44c91c29672f5c Mon Sep 17 00:00:00 2001 From: Eric Allman Date: Tue, 26 Jan 1993 19:36:38 -0800 Subject: [PATCH] some (iffy) changes to prevent suppressing the actual sender during a queue run (interaction with C line in qf file) SCCS-vsn: usr.sbin/sendmail/src/recipient.c 6.4 SCCS-vsn: usr.sbin/sendmail/src/main.c 6.11 SCCS-vsn: usr.sbin/sendmail/src/envelope.c 6.3 SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 6.10 SCCS-vsn: usr.sbin/sendmail/src/version.c 6.15 SCCS-vsn: usr.sbin/sendmail/src/deliver.c 6.12 SCCS-vsn: usr.sbin/sendmail/src/queue.c 6.6 --- usr/src/usr.sbin/sendmail/src/deliver.c | 27 ++++++++++++++++++++++- usr/src/usr.sbin/sendmail/src/envelope.c | 7 +++++- usr/src/usr.sbin/sendmail/src/main.c | 7 +++++- usr/src/usr.sbin/sendmail/src/parseaddr.c | 19 +++++++++++++++- usr/src/usr.sbin/sendmail/src/queue.c | 5 +++-- usr/src/usr.sbin/sendmail/src/recipient.c | 20 +++++++++++------ usr/src/usr.sbin/sendmail/src/version.c | 4 ++-- 7 files changed, 74 insertions(+), 15 deletions(-) diff --git a/usr/src/usr.sbin/sendmail/src/deliver.c b/usr/src/usr.sbin/sendmail/src/deliver.c index 6e6da8b0a7..9d5fee4596 100644 --- a/usr/src/usr.sbin/sendmail/src/deliver.c +++ b/usr/src/usr.sbin/sendmail/src/deliver.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)deliver.c 6.11 (Berkeley) %G%"; +static char sccsid[] = "@(#)deliver.c 6.12 (Berkeley) %G%"; #endif /* not lint */ #include "sendmail.h" @@ -243,6 +243,11 @@ deliver(e, firstto) user = to->q_user; e->e_to = to->q_paddr; to->q_flags |= QDONTSEND; + if (tTd(10, 5)) + { + printf("deliver: QDONTSEND "); + printaddr(to, FALSE); + } /* ** Check to see that these people are allowed to @@ -1479,6 +1484,11 @@ sendall(e, mode) extern ADDRESS *recipient(); e->e_from.q_flags |= QDONTSEND; + if (tTd(13, 5)) + { + printf("sendall: QDONTSEND "); + printaddr(&e->e_from, FALSE); + } (void) recipient(&e->e_from, &e->e_sendqueue, e); } @@ -1531,8 +1541,23 @@ sendall(e, mode) e->e_id = e->e_df = NULL; # ifndef LOCKF if (e->e_lockfp != NULL) + { (void) fclose(e->e_lockfp); + e->e_lockfp = NULL; + } # endif + + /* close any random open files in the envelope */ + if (e->e_dfp != NULL) + { + (void) fclose(e->e_dfp); + e->e_dfp = NULL; + } + if (e->e_xfp != NULL) + { + (void) fclose(e->e_xfp); + e->e_xfp = NULL; + } return; } diff --git a/usr/src/usr.sbin/sendmail/src/envelope.c b/usr/src/usr.sbin/sendmail/src/envelope.c index fd366121a1..3bae08072c 100644 --- a/usr/src/usr.sbin/sendmail/src/envelope.c +++ b/usr/src/usr.sbin/sendmail/src/envelope.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)envelope.c 6.2 (Berkeley) %G%"; +static char sccsid[] = "@(#)envelope.c 6.3 (Berkeley) %G%"; #endif /* not lint */ #include @@ -495,6 +495,11 @@ setsender(from, e) else FromFlag = TRUE; e->e_from.q_flags |= QDONTSEND; + if (tTd(45, 5)) + { + printf("setsender: QDONTSEND "); + printaddr(&e->e_from, FALSE); + } loweraddr(&e->e_from); SuprErrs = FALSE; diff --git a/usr/src/usr.sbin/sendmail/src/main.c b/usr/src/usr.sbin/sendmail/src/main.c index 0cc0b9eb3e..0115fe988c 100644 --- a/usr/src/usr.sbin/sendmail/src/main.c +++ b/usr/src/usr.sbin/sendmail/src/main.c @@ -13,7 +13,7 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)main.c 6.10 (Berkeley) %G%"; +static char sccsid[] = "@(#)main.c 6.11 (Berkeley) %G%"; #endif /* not lint */ #define _DEFINE @@ -874,6 +874,11 @@ main(argc, argv, envp) */ CurEnv->e_from.q_flags |= QDONTSEND; + if (tTd(1, 5)) + { + printf("main: QDONTSEND "); + printaddr(&CurEnv->e_from, FALSE); + } CurEnv->e_to = NULL; sendall(CurEnv, SM_DEFAULT); diff --git a/usr/src/usr.sbin/sendmail/src/parseaddr.c b/usr/src/usr.sbin/sendmail/src/parseaddr.c index 59eea16383..d6f3b493e5 100644 --- a/usr/src/usr.sbin/sendmail/src/parseaddr.c +++ b/usr/src/usr.sbin/sendmail/src/parseaddr.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)parseaddr.c 6.9 (Berkeley) %G%"; +static char sccsid[] = "@(#)parseaddr.c 6.10 (Berkeley) %G%"; #endif /* not lint */ #include "sendmail.h" @@ -1721,6 +1721,8 @@ printaddr(a, follow) bool follow; { bool first = TRUE; + register MAILER *m; + MAILER pseudomailer; static int indent; register int i; @@ -1732,6 +1734,16 @@ printaddr(a, follow) printf("\t"); printf("%x=", a); (void) fflush(stdout); + + /* find the mailer -- carefully */ + m = a->q_mailer; + if (m == NULL) + { + m = &pseudomailer; + m->m_mno = -1; + m->m_name = "NULL"; + } + for (i = indent; i > 0; i--) printf("\t"); printf("\tnext=%x, flags=%o, rmailer %d, alias=%x, sibling=%x, child=%x\n", @@ -1992,6 +2004,11 @@ maplocaluser(a, sendq, e) /* mark old address as dead; insert new address */ a->q_flags |= QDONTSEND; + if (tTd(29, 5)) + { + printf("maplocaluser: QDONTSEND "); + printaddr(a, FALSE); + } a1->q_alias = a; allocaddr(a1, 1, NULL); (void) recipient(a1, sendq, e); diff --git a/usr/src/usr.sbin/sendmail/src/queue.c b/usr/src/usr.sbin/sendmail/src/queue.c index 90697b213c..efc604f2d1 100644 --- a/usr/src/usr.sbin/sendmail/src/queue.c +++ b/usr/src/usr.sbin/sendmail/src/queue.c @@ -10,9 +10,9 @@ #ifndef lint #ifdef QUEUE -static char sccsid[] = "@(#)queue.c 6.5 (Berkeley) %G% (with queueing)"; +static char sccsid[] = "@(#)queue.c 6.6 (Berkeley) %G% (with queueing)"; #else -static char sccsid[] = "@(#)queue.c 6.5 (Berkeley) %G% (without queueing)"; +static char sccsid[] = "@(#)queue.c 6.6 (Berkeley) %G% (without queueing)"; #endif #endif /* not lint */ @@ -426,6 +426,7 @@ runqueue(forkflag) } setproctitle("running queue: %s", QueueDir); + ForceMail = TRUE; # ifdef LOG if (LogLevel > 11) diff --git a/usr/src/usr.sbin/sendmail/src/recipient.c b/usr/src/usr.sbin/sendmail/src/recipient.c index cf47e0e534..225f990df2 100644 --- a/usr/src/usr.sbin/sendmail/src/recipient.c +++ b/usr/src/usr.sbin/sendmail/src/recipient.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)recipient.c 6.3 (Berkeley) %G%"; +static char sccsid[] = "@(#)recipient.c 6.4 (Berkeley) %G%"; #endif /* not lint */ # include @@ -105,17 +105,22 @@ sendto(list, copyf, ctladdr, qflags) (firstone && *p == '\0' && bitset(QPRIMARY, ctladdr->q_flags))) a->q_flags |= QPRIMARY; - /* put on send queue or suppress self-reference */ if (ctladdr != NULL && sameaddr(ctladdr, a)) selfref = TRUE; - else - al = a; + al = a; firstone = FALSE; } /* if this alias doesn't include itself, delete ctladdr */ if (!selfref && ctladdr != NULL) + { + if (tTd(25, 5)) + { + printf("sendtolist: QDONTSEND "); + printaddr(ctladdr, FALSE); + } ctladdr->q_flags |= QDONTSEND; + } /* arrange to send to everyone on the local send list */ prev = sibl = NULL; @@ -195,6 +200,7 @@ addrref(a, r) ** sendq -- a pointer to the head of a queue to put the ** recipient in. Duplicate supression is done ** in this queue. +** e -- the current envelope. ** ** Returns: ** pointer to address actually inserted in send list. @@ -259,7 +265,7 @@ recipient(a, sendq, e) stripquotes(buf); /* check for direct mailing to restricted mailers */ - if (a->q_alias == NULL && m == ProgMailer && !ForceMail) + if (a->q_alias == NULL && m == ProgMailer) { a->q_flags |= QDONTSEND|QBADADDR; usrerr("Cannot mail directly to programs", m->m_name); @@ -344,7 +350,7 @@ recipient(a, sendq, e) if (m == InclMailer) { a->q_flags |= QDONTSEND; - if (a->q_alias == NULL && !ForceMail) + if (a->q_alias == NULL) { a->q_flags |= QBADADDR; usrerr("Cannot mail directly to :include:s"); @@ -362,7 +368,7 @@ recipient(a, sendq, e) p = strrchr(buf, '/'); /* check if writable or creatable */ - if (a->q_alias == NULL && !QueueRun && !ForceMail) + if (a->q_alias == NULL && !QueueRun) { a->q_flags |= QDONTSEND|QBADADDR; usrerr("Cannot mail directly to files"); diff --git a/usr/src/usr.sbin/sendmail/src/version.c b/usr/src/usr.sbin/sendmail/src/version.c index 063d97cfd7..2f0bc0da54 100644 --- a/usr/src/usr.sbin/sendmail/src/version.c +++ b/usr/src/usr.sbin/sendmail/src/version.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)version.c 6.14 (Berkeley) %G%"; +static char sccsid[] = "@(#)version.c 6.15 (Berkeley) %G%"; #endif /* not lint */ -char Version[] = "ALPHA-6.14"; +char Version[] = "ALPHA-6.15"; -- 2.20.1