to be pointer to mailer rather than index.
SCCS-vsn: usr.sbin/sendmail/src/alias.c 3.26
SCCS-vsn: usr.sbin/sendmail/src/conf.c 3.36
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 3.49
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 3.49
SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 3.31
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 3.20
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.56
SCCS-vsn: usr.sbin/sendmail/src/main.c 3.46
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 3.27
# include "sendmail.h"
# ifdef DBM
# include "sendmail.h"
# ifdef DBM
-static char SccsId[] = "@(#)alias.c 3.25 %G% (with DBM)";
+static char SccsId[] = "@(#)alias.c 3.26 %G% (with DBM)";
-static char SccsId[] = "@(#)alias.c 3.25 %G% (without DBM)";
+static char SccsId[] = "@(#)alias.c 3.26 %G% (without DBM)";
- if (al.q_mailer != MN_LOCAL)
+ if (al.q_mailer != LocalMailer)
{
syserr("aliases: %d: cannot alias non-local names", lineno);
continue;
{
syserr("aliases: %d: cannot alias non-local names", lineno);
continue;
printf("forward(%s)\n", user->q_paddr);
# endif DEBUG
printf("forward(%s)\n", user->q_paddr);
# endif DEBUG
- if (user->q_mailer != MN_LOCAL || bitset(QBADADDR, user->q_flags))
+ if (user->q_mailer != LocalMailer || bitset(QBADADDR, user->q_flags))
return;
# ifdef DEBUG
if (user->q_home == NULL)
return;
# ifdef DEBUG
if (user->q_home == NULL)
-static char SccsId[] = "@(#)conf.c 3.35 %G%";
+static char SccsId[] = "@(#)conf.c 3.36 %G%";
\f/*
** Header info table
** Final (null) entry contains the flags used for any other field.
\f/*
** Header info table
** Final (null) entry contains the flags used for any other field.
- if (to->q_mailer != MN_LOCAL && MsgSize > 100000)
+ if (to->q_mailer != LocalMailer && MsgSize > 100000)
{
usrerr("Message exceeds 100000 bytes");
NoReturn++;
{
usrerr("Message exceeds 100000 bytes");
NoReturn++;
}
# ifdef ING70
s = stab("arpa", ST_MAILER, ST_FIND);
}
# ifdef ING70
s = stab("arpa", ST_MAILER, ST_FIND);
- if (s != NULL && From.q_mailer != MN_LOCAL && to->q_mailer == s->s_mailer->m_mno)
+ if (s != NULL && From.q_mailer != LocalMailer && to->q_mailer == s->s_mailer)
{
usrerr("No ARPA mail through this machine: see your system administration");
return (FALSE);
{
usrerr("No ARPA mail through this machine: see your system administration");
return (FALSE);
# include <syslog.h>
# endif LOG
# include <syslog.h>
# endif LOG
-static char SccsId[] = "@(#)deliver.c 3.48 %G%";
+static char SccsId[] = "@(#)deliver.c 3.49 %G%";
/*
** DELIVER -- Deliver a message to a list of addresses.
/*
** DELIVER -- Deliver a message to a list of addresses.
# ifdef DEBUG
if (Debug)
printf("\n--deliver, mailer=%d, host=`%s', first user=`%s'\n",
# ifdef DEBUG
if (Debug)
printf("\n--deliver, mailer=%d, host=`%s', first user=`%s'\n",
- to->q_mailer, to->q_host, to->q_user);
+ to->q_mailer->m_mno, to->q_host, to->q_user);
** manifest lower limit of 4 for MAXPV.
*/
** manifest lower limit of 4 for MAXPV.
*/
- m = Mailer[to->q_mailer];
host = to->q_host;
/* rewrite from address, using rewriting rules */
host = to->q_host;
/* rewrite from address, using rewriting rules */
continue;
/* compute effective uid/gid when sending */
continue;
/* compute effective uid/gid when sending */
- if (to->q_mailer == MN_PROG)
+ if (to->q_mailer == ProgMailer)
ctladdr = getctladdr(to);
user = to->q_user;
ctladdr = getctladdr(to);
user = to->q_user;
continue;
/* save statistics.... */
continue;
/* save statistics.... */
- Stat.stat_nt[to->q_mailer]++;
- Stat.stat_bt[to->q_mailer] += kbytes(MsgSize);
+ Stat.stat_nt[to->q_mailer->m_mno]++;
+ Stat.stat_bt[to->q_mailer->m_mno] += kbytes(MsgSize);
/*
** See if this user name is "special".
/*
** See if this user name is "special".
** with the others, so we fudge on the To person.
*/
** with the others, so we fudge on the To person.
*/
- if (m == Mailer[MN_LOCAL])
{
if (index(user, '/') != NULL)
{
{
if (index(user, '/') != NULL)
{
To = q->q_paddr;
if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
{
To = q->q_paddr;
if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
{
- if (q->q_mailer == MN_LOCAL || q->q_mailer == MN_PROG)
+ if (bitset(M_LOCAL, q->q_mailer->m_flags))
message(Arpa_Info, "deliverable");
else
message(Arpa_Info, "queueable");
message(Arpa_Info, "deliverable");
else
message(Arpa_Info, "queueable");
# include <syslog.h>
# endif LOG
# include <syslog.h>
# endif LOG
-static char SccsId[] = "@(#)main.c 3.45 %G%";
+static char SccsId[] = "@(#)main.c 3.46 %G%";
/*
** SENDMAIL -- Post mail to a set of destinations.
/*
** SENDMAIL -- Post mail to a set of destinations.
bool aliasinit = FALSE;
extern char *ttyname();
extern bool safefile();
bool aliasinit = FALSE;
extern char *ttyname();
extern bool safefile();
bool canrename;
argv[argc] = NULL;
bool canrename;
argv[argc] = NULL;
/*
** Read system control file.
/*
** Read system control file.
+ ** Extract special fields for local use.
*/
readcf(ConfFile, safecf);
*/
readcf(ConfFile, safecf);
+
+ /* our name for SMTP codes */
(void) expand("$i", ibuf, &ibuf[sizeof ibuf - 1]);
HostName = ibuf;
(void) expand("$i", ibuf, &ibuf[sizeof ibuf - 1]);
HostName = ibuf;
+ /* the indices of local and program mailers */
+ st = stab("local", ST_MAILER, ST_FIND);
+ if (st == NULL)
+ syserr("No local mailer defined");
+ else
+ LocalMailer = st->s_mailer;
+ st = stab("prog", ST_MAILER, ST_FIND);
+ if (st == NULL)
+ syserr("No prog mailer defined");
+ else
+ ProgMailer = st->s_mailer;
+
/*
** Initialize aliases.
*/
/*
** Initialize aliases.
*/
errno = 0;
/* collect statistics */
errno = 0;
/* collect statistics */
- Stat.stat_nf[From.q_mailer]++;
- Stat.stat_bf[From.q_mailer] += kbytes(MsgSize);
+ Stat.stat_nf[From.q_mailer->m_mno]++;
+ Stat.stat_bf[From.q_mailer->m_mno] += kbytes(MsgSize);
/*
** Arrange that the person who is sending the mail
/*
** Arrange that the person who is sending the mail
-static char SccsId[] = "@(#)parseaddr.c 3.30 %G%";
+static char SccsId[] = "@(#)parseaddr.c 3.31 %G%";
/*
** PARSE -- Parse an address
/*
** PARSE -- Parse an address
a = buildaddr(pvp, a);
if (a == NULL)
return (NULL);
a = buildaddr(pvp, a);
if (a == NULL)
return (NULL);
- m = Mailer[a->q_mailer];
/*
** Make local copies of the host & user and then
/*
** Make local copies of the host & user and then
usrerr(buf);
return (NULL);
}
usrerr(buf);
return (NULL);
}
- for (mp = Mailer, i = 0; (m = *mp++) != NULL; i++)
+ for (mp = Mailer; (m = *mp++) != NULL; )
{
if (strcmp(m->m_name, *tv) == 0)
break;
{
if (strcmp(m->m_name, *tv) == 0)
break;
syserr("buildaddr: unknown net %s", *tv);
return (NULL);
}
syserr("buildaddr: unknown net %s", *tv);
return (NULL);
}
/* figure out what host (if any) */
tv++;
/* figure out what host (if any) */
tv++;
return (FALSE);
/* if the mailer ignores hosts, we have succeeded! */
return (FALSE);
/* if the mailer ignores hosts, we have succeeded! */
- if (bitset(M_LOCAL, Mailer[a->q_mailer]->m_flags))
+ if (bitset(M_LOCAL, a->q_mailer->m_flags))
return (TRUE);
/* otherwise compare hosts (but be careful for NULL ptrs) */
return (TRUE);
/* otherwise compare hosts (but be careful for NULL ptrs) */
printf("%x=", a);
(void) fflush(stdout);
printf("%s: mailer %d (%s), host `%s', user `%s'\n", a->q_paddr,
printf("%x=", a);
(void) fflush(stdout);
printf("%s: mailer %d (%s), host `%s', user `%s'\n", a->q_paddr,
- a->q_mailer, Mailer[a->q_mailer]->m_name, a->q_host, a->q_user);
+ a->q_mailer->m_mno, a->q_mailer->m_name, a->q_host, a->q_user);
printf("\tnext=%x, flags=%o, rmailer %d\n", a->q_next,
a->q_flags, a->q_rmailer);
printf("\tnext=%x, flags=%o, rmailer %d\n", a->q_next,
a->q_flags, a->q_rmailer);
# include <sys/stat.h>
# include "sendmail.h"
# include <sys/stat.h>
# include "sendmail.h"
-static char SccsId[] = "@(#)recipient.c 3.26 %G%";
+static char SccsId[] = "@(#)recipient.c 3.27 %G%";
/*
** SENDTO -- Designate a send list.
/*
** SENDTO -- Designate a send list.
extern ADDRESS *getctladdr();
To = a->q_paddr;
extern ADDRESS *getctladdr();
To = a->q_paddr;
- m = Mailer[a->q_mailer];
errno = 0;
# ifdef DEBUG
if (Debug)
errno = 0;
# ifdef DEBUG
if (Debug)
** Do sickly crude mapping for program mailing, etc.
*/
** Do sickly crude mapping for program mailing, etc.
*/
- if (a->q_mailer == MN_LOCAL)
+ if (a->q_mailer == LocalMailer)
{
if (a->q_user[0] == '|')
{
{
if (a->q_user[0] == '|')
{
- a->q_mailer = MN_PROG;
- m = Mailer[MN_PROG];
+ a->q_mailer = m = ProgMailer;
a->q_user++;
if (a->q_alias == NULL && Debug == 0)
{
a->q_user++;
if (a->q_alias == NULL && Debug == 0)
{
** Alias the name and handle :include: specs.
*/
** Alias the name and handle :include: specs.
*/
- if (a->q_mailer == MN_LOCAL)
+ if (a->q_mailer == LocalMailer)
{
if (strncmp(a->q_user, ":include:", 9) == 0)
{
{
if (strncmp(a->q_user, ":include:", 9) == 0)
{
** the user (which is probably correct anyway).
*/
** the user (which is probably correct anyway).
*/
- if (!bitset(QDONTSEND, a->q_flags) && a->q_mailer == MN_LOCAL)
+ if (!bitset(QDONTSEND, a->q_flags) && a->q_mailer == LocalMailer)
{
char buf[MAXNAME];
register char *p;
{
char buf[MAXNAME];
register char *p;
# include <pwd.h>
# include "sendmail.h"
# include <pwd.h>
# include "sendmail.h"
-static char SccsId[] = "@(#)savemail.c 3.19 %G%";
+static char SccsId[] = "@(#)savemail.c 3.20 %G%";
/*
** SAVEMAIL -- Save mail on error
/*
** SAVEMAIL -- Save mail on error
if (ArpaMode != ARPA_NONE)
return;
p = NULL;
if (ArpaMode != ARPA_NONE)
return;
p = NULL;
- if (From.q_mailer == MN_LOCAL)
+ if (From.q_mailer == LocalMailer)
{
if (From.q_home != NULL)
p = From.q_home;
{
if (From.q_home != NULL)
p = From.q_home;
(void) expand("$z/dead.letter", buf, &buf[sizeof buf - 1]);
To = buf;
i = mailfile(buf, &From);
(void) expand("$z/dead.letter", buf, &buf[sizeof buf - 1]);
To = buf;
i = mailfile(buf, &From);
- giveresponse(i, TRUE, Mailer[MN_LOCAL]);
+ giveresponse(i, TRUE, LocalMailer);
}
/* add terminator to writeback message */
}
/* add terminator to writeback message */
# ifdef _DEFINE
# define EXTERN
# ifdef _DEFINE
# define EXTERN
-static char SmailSccsId[] = "@(#)sendmail.h 3.48 %G%";
+static char SmailSccsId[] = "@(#)sendmail.h 3.49 %G%";
# else _DEFINE
# define EXTERN extern
# endif _DEFINE
# else _DEFINE
# define EXTERN extern
# endif _DEFINE
char *q_paddr; /* the printname for the address */
char *q_user; /* user name */
char *q_host; /* host name */
char *q_paddr; /* the printname for the address */
char *q_user; /* user name */
char *q_host; /* host name */
- short q_mailer; /* mailer to use */
+ struct mailer *q_mailer; /* mailer to use */
short q_rmailer; /* real mailer (before mapping) */
u_short q_flags; /* status flags, see below */
short q_uid; /* user-id of receiver (if known) */
short q_rmailer; /* real mailer (before mapping) */
u_short q_flags; /* status flags, see below */
short q_uid; /* user-id of receiver (if known) */
# define M_ARPAFMT (M_NEEDDATE|M_NEEDFROM|M_MSGID)
# define M_ARPAFMT (M_NEEDDATE|M_NEEDFROM|M_MSGID)
-EXTERN MAILER *Mailer[MAXMAILERS+1];
-
-/* special mailer numbers */
-# define MN_LOCAL 0 /* local mailer */
-# define MN_PROG 1 /* program mailer */
-/* mailers from 2 on are arbitrary */
+EXTERN MAILER *Mailer[MAXMAILERS+1];
+EXTERN MAILER *LocalMailer; /* ptr to local mailer */
+EXTERN MAILER *ProgMailer; /* ptr to program mailer */
-static char SccsId[] = "@(#)SendMail version 3.55 of %G%";
+static char SccsId[] = "@(#)SendMail version 3.56 of %G%";
-char Version[] = "3.55 [%G%]";
+char Version[] = "3.56 [%G%]";