this is slightly inefficient but simpler. also, pass this queue
around so we can have multiple send queues. this makes VRFY work.
SCCS-vsn: usr.sbin/sendmail/src/alias.c 3.27
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 3.54
SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 3.35
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.65
SCCS-vsn: usr.sbin/sendmail/src/main.c 3.54
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 3.10
SCCS-vsn: usr.sbin/sendmail/src/readcf.c 3.17
SCCS-vsn: usr.sbin/sendmail/src/headers.c 3.11
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 3.30
SCCS-vsn: usr.sbin/sendmail/src/queue.c 3.5
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 3.55
# include "sendmail.h"
# ifdef DBM
# include "sendmail.h"
# ifdef DBM
-static char SccsId[] = "@(#)alias.c 3.26.1.1 %G% (with DBM)";
+static char SccsId[] = "@(#)alias.c 3.27 %G% (with DBM)";
-static char SccsId[] = "@(#)alias.c 3.26.1.1 %G% (without DBM)";
+static char SccsId[] = "@(#)alias.c 3.27 %G% (without DBM)";
**
** Parameters:
** a -- address to alias.
**
** Parameters:
** a -- address to alias.
+** sendq -- a pointer to the head of the send queue
+** to put the aliases in.
extern DATUM fetch();
#endif DBM
extern DATUM fetch();
#endif DBM
{
register char *p;
extern ADDRESS *sendto();
{
register char *p;
extern ADDRESS *sendto();
** to forward to. It must have been verified --
** i.e., the q_home field must have been filled
** in.
** to forward to. It must have been verified --
** i.e., the q_home field must have been filled
** in.
+** sendq -- a pointer to the head of the send queue to
+** put this user's aliases in.
** New names are added to send queues.
*/
** New names are added to send queues.
*/
{
char buf[60];
extern bool safefile();
{
char buf[60];
extern bool safefile();
return;
/* we do have an address to forward to -- do it */
return;
/* we do have an address to forward to -- do it */
- include(buf, "forwarding", user);
+ include(buf, "forwarding", user, sendq);
# include <syslog.h>
# endif LOG
# include <syslog.h>
# endif LOG
-static char SccsId[] = "@(#)deliver.c 3.54.1.1 %G%";
+static char SccsId[] = "@(#)deliver.c 3.55 %G%";
/*
** DELIVER -- Deliver a message to a list of addresses.
/*
** DELIVER -- Deliver a message to a list of addresses.
/* if already sent or not for this host, don't send */
if ((!ForceMail && bitset(QDONTSEND|QPSEUDO, to->q_flags)) ||
/* if already sent or not for this host, don't send */
if ((!ForceMail && bitset(QDONTSEND|QPSEUDO, to->q_flags)) ||
- strcmp(to->q_host, host) != 0)
+ strcmp(to->q_host, host) != 0 || to->q_mailer != firstto->q_mailer)
continue;
/* compute effective uid/gid when sending */
continue;
/* compute effective uid/gid when sending */
sendall(verifyonly)
bool verifyonly;
{
sendall(verifyonly)
bool verifyonly;
{
- for (i = 0; Mailer[i] != NULL; i++)
- {
- ADDRESS *q;
- for (q = Mailer[i]->m_sendq; q != NULL; q = q->q_next)
+ for (q = SendQueue; q != NULL; q = q->q_next)
+ {
+ if (verifyonly)
+ To = q->q_paddr;
+ if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
- To = q->q_paddr;
- if (!bitset(QDONTSEND|QBADADDR|QPSEUDO, q->q_flags))
- {
- if (bitset(M_LOCAL, q->q_mailer->m_flags))
- message(Arpa_Info, "deliverable");
- else
- message(Arpa_Info, "queueable");
- }
+ if (bitset(M_LOCAL, q->q_mailer->m_flags))
+ message(Arpa_Info, "deliverable");
+ else
+ message(Arpa_Info, "queueable");
- else
- (void) deliver(q, (fnptr) NULL);
+ else
+ (void) deliver(q, (fnptr) NULL);
# include <errno.h>
# include "sendmail.h"
# include <errno.h>
# include "sendmail.h"
-static char SccsId[] = "@(#)headers.c 3.10.1.1 %G%";
+static char SccsId[] = "@(#)headers.c 3.11 %G%";
/*
** CHOMPHEADER -- process and save a header line.
/*
** CHOMPHEADER -- process and save a header line.
# include <syslog.h>
# endif LOG
# include <syslog.h>
# endif LOG
-static char SccsId[] = "@(#)main.c 3.53.1.1 %G%";
+static char SccsId[] = "@(#)main.c 3.54 %G%";
/*
** SENDMAIL -- Post mail to a set of destinations.
/*
** SENDMAIL -- Post mail to a set of destinations.
-static char SccsId[] = "@(#)parseaddr.c 3.34 %G%";
+static char SccsId[] = "@(#)parseaddr.c 3.35 %G%";
/*
** PARSE -- Parse an address
/*
** PARSE -- Parse an address
register ADDRESS *a;
bool follow;
{
register ADDRESS *a;
bool follow;
{
static int indent;
register int i;
while (a != NULL)
{
static int indent;
register int i;
while (a != NULL)
{
for (i = indent; i > 0; i--)
printf("\t");
printf("%x=", a);
for (i = indent; i > 0; i--)
printf("\t");
printf("%x=", a);
indent--;
a = a->q_sibling;
}
indent--;
a = a->q_sibling;
}
# include <signal.h>
# include <errno.h>
# include <signal.h>
# include <errno.h>
-static char SccsId[] = "@(#)queue.c 3.4.1.1 %G%";
+static char SccsId[] = "@(#)queue.c 3.5 %G%";
/*
** QUEUEUP -- queue a message up for future transmission.
/*
** QUEUEUP -- queue a message up for future transmission.
register int i;
register HDR *h;
register char *p;
register int i;
register HDR *h;
register char *p;
/* create control file name from data file name */
strcpy(cf, df);
/* create control file name from data file name */
strcpy(cf, df);
fprintf(f, "P%d\n", MsgPriority);
/* output list of recipient addresses */
fprintf(f, "P%d\n", MsgPriority);
/* output list of recipient addresses */
- for (i = 0; Mailer[i] != NULL; i++)
+ for (q = SendQueue; q != NULL; q = q->q_next)
- register ADDRESS *q;
-
- for (q = Mailer[i]->m_sendq; q != NULL; q = q->q_next)
- {
- if (!bitset(QQUEUEUP, q->q_flags))
- continue;
- fprintf(f, "R%s\n", q->q_paddr);
- }
+ if (!bitset(QQUEUEUP, q->q_flags))
+ continue;
+ fprintf(f, "R%s\n", q->q_paddr);
}
/* output headers for this message */
}
/* output headers for this message */
-static char SccsId[] = "@(#)readcf.c 3.16 %G%";
+static char SccsId[] = "@(#)readcf.c 3.17 %G%";
/*
** READCF -- read control file.
/*
** READCF -- read control file.
m->m_flags = mopts;
m->m_from = newstr(mfrom);
m->m_badstat = EX_UNAVAILABLE;
m->m_flags = mopts;
m->m_from = newstr(mfrom);
m->m_badstat = EX_UNAVAILABLE;
m->m_mno = NextMailer;
Mailer[NextMailer++] = m;
m->m_mno = NextMailer;
Mailer[NextMailer++] = m;
# include "sendmail.h"
# include <sys/stat.h>
# include "sendmail.h"
# include <sys/stat.h>
-static char SccsId[] = "@(#)recipient.c 3.29 %G%";
+static char SccsId[] = "@(#)recipient.c 3.30 %G%";
/*
** SENDTO -- Designate a send list.
/*
** SENDTO -- Designate a send list.
** copyf -- the copy flag; passed to parse.
** ctladdr -- the address template for the person to
** send to -- effective uid/gid are important.
** copyf -- the copy flag; passed to parse.
** ctladdr -- the address template for the person to
** send to -- effective uid/gid are important.
+** This is typically the alias that caused this
+** expansion.
+** sendq -- a pointer to the head of a queue to put
+** these people into.
** qflags -- special flags to set in the q_flags field.
**
** Returns:
** qflags -- special flags to set in the q_flags field.
**
** Returns:
**
** Parameters:
** a -- the (preparsed) address header for the recipient.
**
** Parameters:
** a -- the (preparsed) address header for the recipient.
+** sendq -- a pointer to the head of a queue to put the
+** recipient in. Duplicate supression is done
+** in this queue.
**
** Returns:
** pointer to address actually inserted in send list.
**
** Returns:
** pointer to address actually inserted in send list.
+ register ADDRESS **sendq;
{
register ADDRESS *q;
ADDRESS **pq;
{
register ADDRESS *q;
ADDRESS **pq;
** [Please note: the emphasis is on "hack."]
*/
** [Please note: the emphasis is on "hack."]
*/
- for (pq = &m->m_sendq; (q = *pq) != NULL; pq = &q->q_next)
+ for (pq = sendq; (q = *pq) != NULL; pq = &q->q_next)
{
if (!ForceMail && sameaddr(q, a, FALSE))
{
{
if (!ForceMail && sameaddr(q, a, FALSE))
{
{
if (Verbose)
message(Arpa_Info, "including file %s", &a->q_user[9]);
{
if (Verbose)
message(Arpa_Info, "including file %s", &a->q_user[9]);
- include(&a->q_user[9], " sending", a);
+ include(&a->q_user[9], " sending", a, sendq);
if (nbuf[0] != '\0')
a->q_fullname = newstr(nbuf);
if (!quoted)
if (nbuf[0] != '\0')
a->q_fullname = newstr(nbuf);
if (!quoted)
** ctladdr -- address template to use to fill in these
** addresses -- effective user/group id are
** the important things.
** ctladdr -- address template to use to fill in these
** addresses -- effective user/group id are
** the important things.
+** sendq -- a pointer to the head of the send queue
+** to put these addresses in.
** listed in that file.
*/
** listed in that file.
*/
-include(fname, msg, ctladdr)
+include(fname, msg, ctladdr, sendq)
char *fname;
char *msg;
ADDRESS *ctladdr;
char *fname;
char *msg;
ADDRESS *ctladdr;
{
char buf[MAXLINE];
register FILE *fp;
{
char buf[MAXLINE];
register FILE *fp;
# ifdef _DEFINE
# define EXTERN
# ifdef _DEFINE
# define EXTERN
-static char SmailSccsId[] = "@(#)sendmail.h 3.53 %G%";
+static char SmailSccsId[] = "@(#)sendmail.h 3.54 %G%";
# else _DEFINE
# define EXTERN extern
# endif _DEFINE
# else _DEFINE
# define EXTERN extern
# endif _DEFINE
** flags associated with it, and the argument vector to
** pass to it. The flags are defined in conf.c
**
** flags associated with it, and the argument vector to
** pass to it. The flags are defined in conf.c
**
-** The host map is a list of lists of strings. Within each
-** list, any host is mapped to the last host in the list.
-** This allows multiple names, as well as doing clever
-** mail grouping in point-to-point networks. Note: this
-** is only used internally, so the apparent host is still
-** kept around.
-**
** The argument vector is expanded before actual use. All
** words except the first are passed through the macro
** processor.
** The argument vector is expanded before actual use. All
** words except the first are passed through the macro
** processor.
short m_mno; /* mailer number internally */
char *m_from; /* pattern for From: header */
char **m_argv; /* template argument vector */
short m_mno; /* mailer number internally */
char *m_from; /* pattern for From: header */
char **m_argv; /* template argument vector */
- ADDRESS *m_sendq; /* list of addresses to send to */
};
typedef struct mailer MAILER;
};
typedef struct mailer MAILER;
extern char *StatFile; /* location of statistics summary */
extern char *QueueDir; /* location of queue directory */
EXTERN ADDRESS From; /* the person it is from */
extern char *StatFile; /* location of statistics summary */
extern char *QueueDir; /* location of queue directory */
EXTERN ADDRESS From; /* the person it is from */
+EXTERN ADDRESS *SendQueue; /* list of message recipients */
EXTERN long MsgSize; /* size of the message in bytes */
EXTERN time_t CurTime; /* time of this message */
EXTERN long MsgSize; /* size of the message in bytes */
EXTERN time_t CurTime; /* time of this message */
-static char SccsId[] = "@(#)srvrsmtp.c 3.9 %G%";
+static char SccsId[] = "@(#)srvrsmtp.c 3.10 %G%";
/*
** SMTP -- run the SMTP protocol.
/*
** SMTP -- run the SMTP protocol.
# define CMDQUIT 9 /* quit -- close connection and die */
# define CMDMRSQ 10 /* mrsq -- for old mtp compat only */
# define CMDHELO 11 /* helo -- be polite */
# define CMDQUIT 9 /* quit -- close connection and die */
# define CMDMRSQ 10 /* mrsq -- for old mtp compat only */
# define CMDHELO 11 /* helo -- be polite */
+# define CMDDBGSHOWQ 12 /* showq -- show send queue (DEBUG) */
static struct cmd CmdTab[] =
{
static struct cmd CmdTab[] =
{
"quit", CMDQUIT,
"mrsq", CMDMRSQ,
"helo", CMDHELO,
"quit", CMDQUIT,
"mrsq", CMDMRSQ,
"helo", CMDHELO,
+# ifdef DEBUG
+ "showq", CMDDBGSHOWQ,
+# endif DEBUG
+# ifdef DEBUG
+ case CMDDBGSHOWQ: /* show queues */
+ printf("SendQueue=");
+ printaddr(SendQueue, TRUE);
+ break;
+# endif DEBUG
+
case CMDERROR: /* unknown command */
message("500", "Command unrecognized");
break;
case CMDERROR: /* unknown command */
message("500", "Command unrecognized");
break;
-static char SccsId[] = "@(#)SendMail version 3.64 of %G%";
+static char SccsId[] = "@(#)SendMail version 3.65 of %G%";
-char Version[] = "3.64 [%G%]";
+char Version[] = "3.65 [%G%]";