SCCS-vsn: usr.sbin/sendmail/src/alias.c 5.17
SCCS-vsn: usr.sbin/sendmail/src/clock.c 5.7
SCCS-vsn: usr.sbin/sendmail/src/collect.c 5.7
SCCS-vsn: usr.sbin/sendmail/src/conf.h 5.15
SCCS-vsn: usr.sbin/sendmail/src/daemon.c 5.29
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 5.26
SCCS-vsn: usr.sbin/sendmail/src/domain.c 5.19
SCCS-vsn: usr.sbin/sendmail/src/envelope.c 5.18
SCCS-vsn: usr.sbin/sendmail/src/headers.c 5.13
SCCS-vsn: usr.sbin/sendmail/src/macro.c 5.6
SCCS-vsn: usr.sbin/sendmail/src/main.c 5.25
SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 5.10
SCCS-vsn: usr.sbin/sendmail/src/queue.c 5.26
SCCS-vsn: usr.sbin/sendmail/src/readcf.c 5.17
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 5.14
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 5.11
SCCS-vsn: usr.sbin/sendmail/src/stab.c 5.6
SCCS-vsn: usr.sbin/sendmail/src/usersmtp.c 5.12
18 files changed:
-static char sccsid[] = "@(#)alias.c 5.16 (Berkeley) %G% (with DBM)";
+static char sccsid[] = "@(#)alias.c 5.17 (Berkeley) %G% (with DBM)";
-static char sccsid[] = "@(#)alias.c 5.16 (Berkeley) %G% (without DBM)";
+static char sccsid[] = "@(#)alias.c 5.17 (Berkeley) %G% (without DBM)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
extern ADDRESS *sendto();
extern char *aliaslookup();
extern ADDRESS *sendto();
extern char *aliaslookup();
if (tTd(27, 1))
printf("alias(%s)\n", a->q_paddr);
if (tTd(27, 1))
printf("alias(%s)\n", a->q_paddr);
/* don't realias already aliased names */
if (bitset(QDONTSEND, a->q_flags))
/* don't realias already aliased names */
if (bitset(QDONTSEND, a->q_flags))
** Deliver to the target list.
*/
** Deliver to the target list.
*/
if (tTd(27, 1))
printf("%s (%s, %s) aliased to %s\n",
a->q_paddr, a->q_host, a->q_user, p);
if (tTd(27, 1))
printf("%s (%s, %s) aliased to %s\n",
a->q_paddr, a->q_host, a->q_user, p);
message(Arpa_Info, "aliased to %s", p);
AliasLevel++;
a->q_child = sendto(p, 1, a, 0);
message(Arpa_Info, "aliased to %s", p);
AliasLevel++;
a->q_child = sendto(p, 1, a, 0);
if ((af = fopen(aliasfile, "r")) == NULL)
{
if ((af = fopen(aliasfile, "r")) == NULL)
{
if (tTd(27, 1))
printf("Can't open %s\n", aliasfile);
if (tTd(27, 1))
printf("Can't open %s\n", aliasfile);
errno = 0;
NoAlias++;
return;
errno = 0;
NoAlias++;
return;
char buf[60];
extern bool safefile();
char buf[60];
extern bool safefile();
if (tTd(27, 1))
printf("forward(%s)\n", user->q_paddr);
if (tTd(27, 1))
printf("forward(%s)\n", user->q_paddr);
if (user->q_mailer != LocalMailer || bitset(QBADADDR, user->q_flags))
return;
if (user->q_mailer != LocalMailer || bitset(QBADADDR, user->q_flags))
return;
if (user->q_home == NULL)
syserr("forward: no home");
if (user->q_home == NULL)
syserr("forward: no home");
/* good address -- look for .forward file in home */
define('z', user->q_home, CurEnv);
/* good address -- look for .forward file in home */
define('z', user->q_home, CurEnv);
-static char sccsid[] = "@(#)clock.c 5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)clock.c 5.7 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
auto time_t now;
extern tick();
auto time_t now;
extern tick();
if (intvl <= 0)
{
syserr("setevent: intvl=%ld\n", intvl);
return (NULL);
}
if (intvl <= 0)
{
syserr("setevent: intvl=%ld\n", intvl);
return (NULL);
}
ev->ev_link = *evp;
*evp = ev;
ev->ev_link = *evp;
*evp = ev;
if (tTd(5, 5))
printf("setevent: intvl=%ld, for=%ld, func=%x, arg=%d, ev=%x\n",
intvl, now + intvl, func, arg, ev);
if (tTd(5, 5))
printf("setevent: intvl=%ld, for=%ld, func=%x, arg=%d, ev=%x\n",
intvl, now + intvl, func, arg, ev);
if (tTd(5, 5))
printf("clrevent: ev=%x\n", ev);
if (tTd(5, 5))
printf("clrevent: ev=%x\n", ev);
(void) alarm(0);
now = curtime();
(void) alarm(0);
now = curtime();
if (tTd(5, 4))
printf("tick: now=%ld\n", now);
if (tTd(5, 4))
printf("tick: now=%ld\n", now);
while ((ev = EventQueue) != NULL &&
(ev->ev_time <= now || ev->ev_pid != mypid))
while ((ev = EventQueue) != NULL &&
(ev->ev_time <= now || ev->ev_pid != mypid))
/* process the event on the top of the queue */
ev = EventQueue;
EventQueue = EventQueue->ev_link;
/* process the event on the top of the queue */
ev = EventQueue;
EventQueue = EventQueue->ev_link;
if (tTd(5, 6))
printf("tick: ev=%x, func=%x, arg=%d, pid=%d\n", ev,
ev->ev_func, ev->ev_arg, ev->ev_pid);
if (tTd(5, 6))
printf("tick: ev=%x, func=%x, arg=%d, pid=%d\n", ev,
ev->ev_func, ev->ev_arg, ev->ev_pid);
/* we must be careful in here because ev_func may not return */
(void) signal(SIGALRM, tick);
/* we must be careful in here because ev_func may not return */
(void) signal(SIGALRM, tick);
-static char sccsid[] = "@(#)collect.c 5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)collect.c 5.7 (Berkeley) %G%";
#endif /* not lint */
# include <errno.h>
#endif /* not lint */
# include <errno.h>
break;
} while (sfgets(buf, MAXFIELD, InChannel) != NULL);
break;
} while (sfgets(buf, MAXFIELD, InChannel) != NULL);
if (tTd(30, 1))
printf("EOH\n");
if (tTd(30, 1))
printf("EOH\n");
/* throw away a blank line */
if (buf[0] == '\0')
/* throw away a blank line */
if (buf[0] == '\0')
{
if (q->q_alias != NULL)
continue;
{
if (q->q_alias != NULL)
continue;
if (tTd(30, 3))
printf("Adding Apparently-To: %s\n", q->q_paddr);
if (tTd(30, 3))
printf("Adding Apparently-To: %s\n", q->q_paddr);
addheader("apparently-to", q->q_paddr, CurEnv);
}
}
addheader("apparently-to", q->q_paddr, CurEnv);
}
}
register char *p;
register char **dt;
register char *p;
register char **dt;
if (tTd(30, 2))
printf("eatfrom(%s)\n", fm);
if (tTd(30, 2))
printf("eatfrom(%s)\n", fm);
/* find the date part */
p = fm;
/* find the date part */
p = fm;
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#)conf.h 5.14 (Berkeley) %G%
+ * @(#)conf.h 5.15 (Berkeley) %G%
# define DBM 1 /* use DBM library (requires -ldbm) */
# define NDBM 1 /* new DBM library available (requires DBM) */
# define DBM 1 /* use DBM library (requires -ldbm) */
# define NDBM 1 /* new DBM library available (requires DBM) */
-# define DEBUG 1 /* enable debugging */
# define LOG 1 /* enable logging */
# define SMTP 1 /* enable user and server SMTP */
# define QUEUE 1 /* enable queueing */
# define LOG 1 /* enable logging */
# define SMTP 1 /* enable user and server SMTP */
# define QUEUE 1 /* enable queueing */
#ifndef lint
#ifdef DAEMON
#ifndef lint
#ifdef DAEMON
-static char sccsid[] = "@(#)daemon.c 5.28 (Berkeley) %G% (with daemon mode)";
+static char sccsid[] = "@(#)daemon.c 5.29 (Berkeley) %G% (with daemon mode)";
-static char sccsid[] = "@(#)daemon.c 5.28 (Berkeley) %G% (without daemon mode)";
+static char sccsid[] = "@(#)daemon.c 5.29 (Berkeley) %G% (without daemon mode)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
** Try to actually open the connection.
*/
** Try to actually open the connection.
*/
if (tTd(15, 1))
printf("getrequests: port 0x%x\n", SendmailAddress.sin_port);
if (tTd(15, 1))
printf("getrequests: port 0x%x\n", SendmailAddress.sin_port);
/* get a socket for the SMTP connection */
DaemonSocket = socket(AF_INET, SOCK_STREAM, 0);
/* get a socket for the SMTP connection */
DaemonSocket = socket(AF_INET, SOCK_STREAM, 0);
/* turn on network debugging? */
if (tTd(15, 15))
(void) setsockopt(DaemonSocket, SOL_SOCKET, SO_DEBUG, (char *)&on, sizeof on);
/* turn on network debugging? */
if (tTd(15, 15))
(void) setsockopt(DaemonSocket, SOL_SOCKET, SO_DEBUG, (char *)&on, sizeof on);
(void) setsockopt(DaemonSocket, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof on);
(void) setsockopt(DaemonSocket, SOL_SOCKET, SO_KEEPALIVE, (char *)&on, sizeof on);
(void) setsockopt(DaemonSocket, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof on);
(void) setsockopt(DaemonSocket, SOL_SOCKET, SO_KEEPALIVE, (char *)&on, sizeof on);
(void) signal(SIGCHLD, reapchild);
(void) signal(SIGCHLD, reapchild);
if (tTd(15, 1))
printf("getrequests: %d\n", DaemonSocket);
if (tTd(15, 1))
printf("getrequests: %d\n", DaemonSocket);
if (tTd(16, 1))
printf("makeconnection (%s [%s])\n", host,
inet_ntoa(SendmailAddress.sin_addr.s_addr));
if (tTd(16, 1))
printf("makeconnection (%s [%s])\n", host,
inet_ntoa(SendmailAddress.sin_addr.s_addr));
#ifdef NVMUNIX
s = socket(AF_INET, SOCK_STREAM, 0, 0);
#ifdef NVMUNIX
s = socket(AF_INET, SOCK_STREAM, 0, 0);
if (tTd(16, 1))
printf("makeconnection: %d\n", s);
if (tTd(16, 1))
printf("makeconnection: %d\n", s);
int on = 1;
(void) setsockopt(DaemonSocket, SOL_SOCKET, SO_DEBUG, (char *)&on, sizeof on);
}
int on = 1;
(void) setsockopt(DaemonSocket, SOL_SOCKET, SO_DEBUG, (char *)&on, sizeof on);
}
(void) fflush(CurEnv->e_xfp); /* for debugging */
errno = 0; /* for debugging */
#ifdef NVMUNIX
(void) fflush(CurEnv->e_xfp); /* for debugging */
errno = 0; /* for debugging */
#ifdef NVMUNIX
-static char sccsid[] = "@(#)deliver.c 5.25 (Berkeley) %G%";
+static char sccsid[] = "@(#)deliver.c 5.26 (Berkeley) %G%";
#endif /* not lint */
#include <sendmail.h>
#endif /* not lint */
#include <sendmail.h>
m = to->q_mailer;
host = to->q_host;
m = to->q_mailer;
host = to->q_host;
if (tTd(10, 1))
printf("\n--deliver, mailer=%d, host=`%s', first user=`%s'\n",
m->m_mno, host, to->q_user);
if (tTd(10, 1))
printf("\n--deliver, mailer=%d, host=`%s', first user=`%s'\n",
m->m_mno, host, to->q_user);
/*
** If this mailer is expensive, and if we don't want to make
/*
** If this mailer is expensive, and if we don't want to make
if (sizeof tobuf - (strlen(to->q_paddr) + strlen(tobuf) + 2) < 0)
break;
if (sizeof tobuf - (strlen(to->q_paddr) + strlen(tobuf) + 2) < 0)
break;
if (tTd(10, 1))
{
printf("\nsend to ");
printaddr(to, FALSE);
}
if (tTd(10, 1))
{
printf("\nsend to ");
printaddr(to, FALSE);
}
/* compute effective uid/gid when sending */
if (to->q_mailer == ProgMailer)
/* compute effective uid/gid when sending */
if (to->q_mailer == ProgMailer)
FILE *rfile;
extern FILE *fdopen();
FILE *rfile;
extern FILE *fdopen();
if (tTd(11, 1))
{
printf("openmailer:");
printav(pvp);
}
if (tTd(11, 1))
{
printf("openmailer:");
printav(pvp);
}
errno = 0;
CurHostName = m->m_mailer;
errno = 0;
CurHostName = m->m_mailer;
** We also handle a debug version that just talks to stdin/out.
*/
** We also handle a debug version that just talks to stdin/out.
*/
/* check for Local Person Communication -- not for mortals!!! */
if (strcmp(m->m_mailer, "[LPC]") == 0)
{
/* check for Local Person Communication -- not for mortals!!! */
if (strcmp(m->m_mailer, "[LPC]") == 0)
{
*prfile = stdin;
return (0);
}
*prfile = stdin;
return (0);
}
if (strcmp(m->m_mailer, "[IPC]") == 0)
{
if (strcmp(m->m_mailer, "[IPC]") == 0)
{
if (tTd(13, 1))
{
printf("\nSENDALL: mode %c, sendqueue:\n", mode);
printaddr(e->e_sendqueue, TRUE);
}
if (tTd(13, 1))
{
printf("\nSENDALL: mode %c, sendqueue:\n", mode);
printaddr(e->e_sendqueue, TRUE);
}
/*
** Do any preprocessing necessary for the mode we are running.
/*
** Do any preprocessing necessary for the mode we are running.
if (tTd(13, 3))
{
printf("Checking ");
printaddr(q, FALSE);
}
if (tTd(13, 3))
{
printf("Checking ");
printaddr(q, FALSE);
}
/* only send errors if the message failed */
if (!bitset(QBADADDR, q->q_flags))
/* only send errors if the message failed */
if (!bitset(QBADADDR, q->q_flags))
if (aliaslookup(obuf) == NULL)
continue;
if (aliaslookup(obuf) == NULL)
continue;
if (tTd(13, 4))
printf("Errors to %s\n", obuf);
if (tTd(13, 4))
printf("Errors to %s\n", obuf);
/* owner list exists -- add it to the error queue */
sendtolist(obuf, (ADDRESS *) NULL, &e->e_errorqueue);
/* owner list exists -- add it to the error queue */
sendtolist(obuf, (ADDRESS *) NULL, &e->e_errorqueue);
#ifndef lint
#ifdef NAMED_BIND
#ifndef lint
#ifdef NAMED_BIND
-static char sccsid[] = "@(#)domain.c 5.18 (Berkeley) %G% (with name server)";
+static char sccsid[] = "@(#)domain.c 5.19 (Berkeley) %G% (with name server)";
-static char sccsid[] = "@(#)domain.c 5.18 (Berkeley) %G% (without name server)";
+static char sccsid[] = "@(#)domain.c 5.19 (Berkeley) %G% (without name server)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
n = res_search(host, C_IN, T_MX, (char *)&answer, sizeof(answer));
if (n < 0)
{
n = res_search(host, C_IN, T_MX, (char *)&answer, sizeof(answer));
if (n < 0)
{
if (tTd(8, 1))
printf("getmxrr: res_search failed (errno=%d, h_errno=%d)\n",
errno, h_errno);
if (tTd(8, 1))
printf("getmxrr: res_search failed (errno=%d, h_errno=%d)\n",
errno, h_errno);
switch (h_errno)
{
case NO_DATA:
switch (h_errno)
{
case NO_DATA:
cp += sizeof(u_short) + sizeof(u_long);
GETSHORT(n, cp);
if (type != T_MX) {
cp += sizeof(u_short) + sizeof(u_long);
GETSHORT(n, cp);
if (type != T_MX) {
if (tTd(8, 1) || _res.options & RES_DEBUG)
printf("unexpected answer type %d, size %d\n",
type, n);
if (tTd(8, 1) || _res.options & RES_DEBUG)
printf("unexpected answer type %d, size %d\n",
type, n);
n = res_search(host, C_IN, T_CNAME, (char *)&answer, sizeof(answer));
# endif
if (n < 0) {
n = res_search(host, C_IN, T_CNAME, (char *)&answer, sizeof(answer));
# endif
if (n < 0) {
if (tTd(8, 1))
printf("getcanonname: res_search failed (errno=%d, h_errno=%d)\n",
errno, h_errno);
if (tTd(8, 1))
printf("getcanonname: res_search failed (errno=%d, h_errno=%d)\n",
errno, h_errno);
/* we don't care about errors here, only if we got an answer */
if (ancount == 0) {
/* we don't care about errors here, only if we got an answer */
if (ancount == 0) {
if (tTd(8, 1))
printf("rcode = %d, ancount=%d\n", hp->rcode, ancount);
if (tTd(8, 1))
printf("rcode = %d, ancount=%d\n", hp->rcode, ancount);
return;
}
cp = (u_char *)&answer + sizeof(HEADER);
return;
}
cp = (u_char *)&answer + sizeof(HEADER);
-static char sccsid[] = "@(#)envelope.c 5.17 (Berkeley) %G%";
+static char sccsid[] = "@(#)envelope.c 5.18 (Berkeley) %G%";
#endif /* not lint */
#include <pwd.h>
#endif /* not lint */
#include <pwd.h>
bool queueit = FALSE;
register ADDRESS *q;
bool queueit = FALSE;
register ADDRESS *q;
if (tTd(50, 1))
{
printf("dropenvelope %x id=", e);
xputs(e->e_id);
printf(" flags=%o\n", e->e_flags);
}
if (tTd(50, 1))
{
printf("dropenvelope %x id=", e);
xputs(e->e_id);
printf(" flags=%o\n", e->e_flags);
}
#ifdef LOG
if (LogLevel > 10)
syslog(LOG_DEBUG, "dropenvelope, id=%s, flags=%o, pid=%d",
#ifdef LOG
if (LogLevel > 10)
syslog(LOG_DEBUG, "dropenvelope, id=%s, flags=%o, pid=%d",
extern bool safefile();
extern char *FullName;
extern bool safefile();
extern char *FullName;
if (tTd(45, 1))
printf("setsender(%s)\n", from == NULL ? "" : from);
if (tTd(45, 1))
printf("setsender(%s)\n", from == NULL ? "" : from);
/*
** Figure out the real user executing us.
/*
** Figure out the real user executing us.
-static char sccsid[] = "@(#)headers.c 5.12 (Berkeley) %G%";
+static char sccsid[] = "@(#)headers.c 5.13 (Berkeley) %G%";
#endif /* not lint */
# include <errno.h>
#endif /* not lint */
# include <errno.h>
extern char *crackaddr();
extern ADDRESS *sendto();
extern char *crackaddr();
extern ADDRESS *sendto();
if (tTd(31, 6))
printf("chompheader: %s\n", line);
if (tTd(31, 6))
printf("chompheader: %s\n", line);
/* strip off options */
clrbitmap(mopts);
/* strip off options */
clrbitmap(mopts);
register char *p;
int hopcnt = 0;
register char *p;
int hopcnt = 0;
if (tTd(32, 1))
printf("----- collected header -----\n");
if (tTd(32, 1))
printf("----- collected header -----\n");
for (h = e->e_header; h != NULL; h = h->h_link)
{
for (h = e->e_header; h != NULL; h = h->h_link)
{
extern char *capitalize();
if (tTd(32, 1))
printf("%s: %s\n", capitalize(h->h_field), h->h_value);
extern char *capitalize();
if (tTd(32, 1))
printf("%s: %s\n", capitalize(h->h_field), h->h_value);
/* count the number of times it has been processed */
if (bitset(H_TRACE, h->h_flags))
hopcnt++;
/* count the number of times it has been processed */
if (bitset(H_TRACE, h->h_flags))
hopcnt++;
if (tTd(32, 1))
printf("----------------------------\n");
if (tTd(32, 1))
printf("----------------------------\n");
/* store hop count */
if (hopcnt > e->e_hopcount)
/* store hop count */
if (hopcnt > e->e_hopcount)
bool gotaddr;
register char *bp;
bool gotaddr;
register char *bp;
if (tTd(33, 1))
printf("crackaddr(%s)\n", addr);
if (tTd(33, 1))
printf("crackaddr(%s)\n", addr);
(void) strcpy(buf, "");
rhs = NULL;
(void) strcpy(buf, "");
rhs = NULL;
(void) strcpy(bp, rhs);
}
(void) strcpy(bp, rhs);
}
if (tTd(33, 1))
printf("crackaddr=>`%s'\n", buf);
if (tTd(33, 1))
printf("crackaddr=>`%s'\n", buf);
** mailer and with commas.
*/
** mailer and with commas.
*/
if (tTd(14, 2))
printf("commaize(%s: %s)\n", h->h_field, p);
if (tTd(14, 2))
printf("commaize(%s: %s)\n", h->h_field, p);
obp = obuf;
(void) sprintf(obp, "%s: ", capitalize(h->h_field));
obp = obuf;
(void) sprintf(obp, "%s: ", capitalize(h->h_field));
-static char sccsid[] = "@(#)macro.c 5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)macro.c 5.6 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
char xbuf[BUFSIZ];
extern char *macvalue();
char xbuf[BUFSIZ];
extern char *macvalue();
if (tTd(35, 24))
{
printf("expand(");
xputs(s);
printf(")\n");
}
if (tTd(35, 24))
{
printf("expand(");
xputs(s);
printf(")\n");
}
skipping = FALSE;
if (s == NULL)
skipping = FALSE;
if (s == NULL)
if (tTd(35, 24))
{
printf("expand ==> ");
xputs(xbuf);
printf("\n");
}
if (tTd(35, 24))
{
printf("expand ==> ");
xputs(xbuf);
printf("\n");
}
/* recurse as appropriate */
if (recurse)
/* recurse as appropriate */
if (recurse)
char *v;
register ENVELOPE *e;
{
char *v;
register ENVELOPE *e;
{
if (tTd(35, 9))
{
printf("define(%c as ", n);
xputs(v);
printf(")\n");
}
if (tTd(35, 9))
{
printf("define(%c as ", n);
xputs(v);
printf(")\n");
}
e->e_macro[n & 0177] = v;
}
\f/*
e->e_macro[n & 0177] = v;
}
\f/*
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 5.24 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 5.25 (Berkeley) %G%";
#endif /* not lint */
#define _DEFINE
#endif /* not lint */
#define _DEFINE
}
else if (strncmp(p, "-bz", 3) == 0)
nothaw = TRUE;
}
else if (strncmp(p, "-bz", 3) == 0)
nothaw = TRUE;
else if (strncmp(p, "-d", 2) == 0)
{
tTsetup(tTdvect, sizeof tTdvect, "0-99.1");
else if (strncmp(p, "-d", 2) == 0)
{
tTsetup(tTdvect, sizeof tTdvect, "0-99.1");
setbuf(stdout, (char *) NULL);
printf("Version %s\n", Version);
}
setbuf(stdout, (char *) NULL);
printf("Version %s\n", Version);
}
}
if (!nothaw)
readconfig = !thaw(FreezeFile);
}
if (!nothaw)
readconfig = !thaw(FreezeFile);
av = myhostname(jbuf, sizeof jbuf);
if (jbuf[0] != '\0')
{
av = myhostname(jbuf, sizeof jbuf);
if (jbuf[0] != '\0')
{
if (tTd(0, 4))
printf("canonical name: %s\n", jbuf);
if (tTd(0, 4))
printf("canonical name: %s\n", jbuf);
p = newstr(jbuf);
define('w', p, CurEnv);
setclass('w', p);
}
while (av != NULL && *av != NULL)
{
p = newstr(jbuf);
define('w', p, CurEnv);
setclass('w', p);
}
while (av != NULL && *av != NULL)
{
if (tTd(0, 4))
printf("\ta.k.a.: %s\n", *av);
if (tTd(0, 4))
printf("\ta.k.a.: %s\n", *av);
case 'C': /* select configuration file (already done) */
break;
case 'C': /* select configuration file (already done) */
break;
case 'd': /* debugging -- redo in case frozen */
tTsetup(tTdvect, sizeof tTdvect, "0-99.1");
tTflag(&p[2]);
case 'd': /* debugging -- redo in case frozen */
tTsetup(tTdvect, sizeof tTdvect, "0-99.1");
tTflag(&p[2]);
_res.options |= RES_DEBUG;
#endif
break;
_res.options |= RES_DEBUG;
#endif
break;
case 'f': /* from address */
case 'r': /* obsolete -f flag */
case 'f': /* from address */
case 'r': /* obsolete -f flag */
if (tTd(0, 15))
{
/* print configuration table (or at least part of it) */
if (tTd(0, 15))
{
/* print configuration table (or at least part of it) */
/*
** Switch to the main envelope.
/*
** Switch to the main envelope.
if (OpMode != MD_VERIFY)
markstats(CurEnv, (ADDRESS *) NULL);
if (OpMode != MD_VERIFY)
markstats(CurEnv, (ADDRESS *) NULL);
if (tTd(1, 1))
printf("From person = \"%s\"\n", CurEnv->e_from.q_paddr);
if (tTd(1, 1))
printf("From person = \"%s\"\n", CurEnv->e_from.q_paddr);
/*
** Actually send everything.
/*
** Actually send everything.
if (tTd(2, 1))
printf("\n====finis: stat %d e_flags %o\n", ExitStat, CurEnv->e_flags);
if (tTd(2, 1))
printf("\n====finis: stat %d e_flags %o\n", ExitStat, CurEnv->e_flags);
/* clean up temp files */
CurEnv->e_to = NULL;
/* clean up temp files */
CurEnv->e_to = NULL;
if (tTd(52, 1))
printf("disconnect: In %d Out %d\n", fileno(InChannel),
fileno(OutChannel));
if (tTd(52, 1))
printf("disconnect: In %d Out %d\n", fileno(InChannel),
fileno(OutChannel));
printf("don't\n");
return;
}
printf("don't\n");
return;
}
/* be sure we don't get nasty signals */
(void) signal(SIGHUP, SIG_IGN);
/* be sure we don't get nasty signals */
(void) signal(SIGHUP, SIG_IGN);
-static char sccsid[] = "@(#)parseaddr.c 5.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)parseaddr.c 5.10 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
if (tTd(20, 1))
printf("\n--parseaddr(%s)\n", addr);
if (tTd(20, 1))
printf("\n--parseaddr(%s)\n", addr);
pvp = prescan(addr, delim, pvpbuf);
if (pvp == NULL)
pvp = prescan(addr, delim, pvpbuf);
if (pvp == NULL)
** Compute return value.
*/
** Compute return value.
*/
if (tTd(20, 1))
{
printf("parseaddr-->");
printaddr(a, FALSE);
}
if (tTd(20, 1))
{
printf("parseaddr-->");
printaddr(a, FALSE);
}
state = OPR;
c = NOCHAR;
p = addr;
state = OPR;
c = NOCHAR;
p = addr;
if (tTd(22, 45))
{
printf("prescan: ");
xputs(p);
(void) putchar('\n');
}
if (tTd(22, 45))
{
printf("prescan: ");
xputs(p);
(void) putchar('\n');
}
if (tTd(22, 101))
printf("c=%c, s=%d; ", c, state);
if (tTd(22, 101))
printf("c=%c, s=%d; ", c, state);
/* chew up special characters */
*q = '\0';
/* chew up special characters */
*q = '\0';
break;
newstate = StateTab[state][toktype(c)];
break;
newstate = StateTab[state][toktype(c)];
if (tTd(22, 101))
printf("ns=%02o\n", newstate);
if (tTd(22, 101))
printf("ns=%02o\n", newstate);
state = newstate & TYPE;
if (bitset(M, newstate))
c = NOCHAR;
state = newstate & TYPE;
if (bitset(M, newstate))
c = NOCHAR;
if (tok != q)
{
*q++ = '\0';
if (tok != q)
{
*q++ = '\0';
if (tTd(22, 36))
{
printf("tok=");
xputs(tok);
(void) putchar('\n');
}
if (tTd(22, 36))
{
printf("tok=");
xputs(tok);
(void) putchar('\n');
}
if (avp >= &av[MAXATOM])
{
syserr("prescan: too many tokens");
if (avp >= &av[MAXATOM])
{
syserr("prescan: too many tokens");
for (rwr = RewriteRules[ruleset]; rwr != NULL; )
{
for (rwr = RewriteRules[ruleset]; rwr != NULL; )
{
if (tTd(21, 12))
{
printf("-----trying rule:");
printav(rwr->r_lhs);
}
if (tTd(21, 12))
{
printf("-----trying rule:");
printav(rwr->r_lhs);
}
/* try to match on this rule */
mlp = mlist;
/* try to match on this rule */
mlp = mlist;
while ((ap = *avp) != NULL || *rvp != NULL)
{
rp = *rvp;
while ((ap = *avp) != NULL || *rvp != NULL)
{
rp = *rvp;
if (tTd(21, 35))
{
printf("ap=");
if (tTd(21, 35))
{
printf("ap=");
xputs(rp);
printf("\n");
}
xputs(rp);
printf("\n");
}
if (rp == NULL)
{
/* end-of-pattern before end-of-address */
if (rp == NULL)
{
/* end-of-pattern before end-of-address */
if (rvp < rwr->r_lhs || *rvp != NULL)
{
if (rvp < rwr->r_lhs || *rvp != NULL)
{
if (tTd(21, 10))
printf("----- rule fails\n");
if (tTd(21, 10))
printf("----- rule fails\n");
rwr = rwr->r_next;
continue;
}
rvp = rwr->r_rhs;
rwr = rwr->r_next;
continue;
}
rvp = rwr->r_rhs;
if (tTd(21, 12))
{
printf("-----rule matches:");
printav(rvp);
}
if (tTd(21, 12))
{
printf("-----rule matches:");
printav(rvp);
}
rp = *rvp;
if (*rp == CANONUSER)
rp = *rvp;
if (*rp == CANONUSER)
syserr("rewrite: ruleset %d: replacement out of bounds", ruleset);
return;
}
syserr("rewrite: ruleset %d: replacement out of bounds", ruleset);
return;
}
if (tTd(21, 15))
{
printf("$%c:", rp[1]);
if (tTd(21, 15))
{
printf("$%c:", rp[1]);
pp = m->first;
while (pp <= m->last)
{
pp = m->first;
while (pp <= m->last)
{
** Done with rewriting this pass.
*/
** Done with rewriting this pass.
*/
if (tTd(21, 4))
{
printf("rewritten as:");
printav(pvp);
}
if (tTd(21, 4))
{
printf("rewritten as:");
printav(pvp);
}
}
if (OpMode == MD_TEST || tTd(21, 2))
}
if (OpMode == MD_TEST || tTd(21, 2))
printaddr(a, follow)
register ADDRESS *a;
bool follow;
printaddr(a, follow)
register ADDRESS *a;
bool follow;
\f/*
** REMOTENAME -- return the name relative to the current mailer
**
\f/*
** REMOTENAME -- return the name relative to the current mailer
**
extern char **prescan();
extern char *crackaddr();
extern char **prescan();
extern char *crackaddr();
if (tTd(12, 1))
printf("remotename(%s)\n", name);
if (tTd(12, 1))
printf("remotename(%s)\n", name);
/* don't do anything if we are tagging it as special */
if ((senderaddress ? m->m_s_rwset : m->m_r_rwset) < 0)
/* don't do anything if we are tagging it as special */
if ((senderaddress ? m->m_s_rwset : m->m_r_rwset) < 0)
expand(fancy, buf, &buf[sizeof buf - 1], CurEnv);
define('g', oldg, CurEnv);
expand(fancy, buf, &buf[sizeof buf - 1], CurEnv);
define('g', oldg, CurEnv);
if (tTd(12, 1))
printf("remotename => `%s'\n", buf);
if (tTd(12, 1))
printf("remotename => `%s'\n", buf);
#ifndef lint
#ifdef QUEUE
#ifndef lint
#ifdef QUEUE
-static char sccsid[] = "@(#)queue.c 5.25 (Berkeley) %G% (with queueing)";
+static char sccsid[] = "@(#)queue.c 5.26 (Berkeley) %G% (with queueing)";
-static char sccsid[] = "@(#)queue.c 5.25 (Berkeley) %G% (without queueing)";
+static char sccsid[] = "@(#)queue.c 5.26 (Berkeley) %G% (without queueing)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
}
(void) chmod(tf, FileMode);
}
(void) chmod(tf, FileMode);
if (tTd(40, 1))
printf("queueing %s\n", e->e_id);
if (tTd(40, 1))
printf("queueing %s\n", e->e_id);
/*
** If there is no data file yet, create one.
/*
** If there is no data file yet, create one.
logdelivery("queued");
e->e_to = NULL;
}
logdelivery("queued");
e->e_to = NULL;
}
if (tTd(40, 1))
{
printf("queueing ");
printaddr(q, FALSE);
}
if (tTd(40, 1))
{
printf("queueing ");
printaddr(q, FALSE);
}
{
/* this may be some random person sending hir msgs */
/* syserr("orderq: cannot open %s", cbuf); */
{
/* this may be some random person sending hir msgs */
/* syserr("orderq: cannot open %s", cbuf); */
if (tTd(41, 2))
printf("orderq: cannot open %s (%d)\n",
d->d_name, errno);
if (tTd(41, 2))
printf("orderq: cannot open %s (%d)\n",
d->d_name, errno);
errno = 0;
wn--;
continue;
errno = 0;
wn--;
continue;
if (tTd(40, 1))
{
for (w = WorkQ; w != NULL; w = w->w_next)
printf("%32s: pri=%ld\n", w->w_name, w->w_pri);
}
if (tTd(40, 1))
{
for (w = WorkQ; w != NULL; w = w->w_next)
printf("%32s: pri=%ld\n", w->w_name, w->w_pri);
}
register int i;
extern bool shouldqueue();
register int i;
extern bool shouldqueue();
if (tTd(40, 1))
printf("dowork: %s pri %ld\n", w->w_name, w->w_pri);
if (tTd(40, 1))
printf("dowork: %s pri %ld\n", w->w_name, w->w_pri);
/*
** Ignore jobs that are too expensive for the moment.
/*
** Ignore jobs that are too expensive for the moment.
printf("\nRunning %s\n", e->e_id);
while (fgetfolded(buf, sizeof buf, qfp) != NULL)
{
printf("\nRunning %s\n", e->e_id);
while (fgetfolded(buf, sizeof buf, qfp) != NULL)
{
if (tTd(40, 4))
printf("+++++ %s\n", buf);
if (tTd(40, 4))
printf("+++++ %s\n", buf);
switch (buf[0])
{
case 'R': /* specify recipient */
switch (buf[0])
{
case 'R': /* specify recipient */
}
lf[2] = nf[2] = qf[2] = c1;
lf[3] = nf[3] = qf[3] = ++c2;
}
lf[2] = nf[2] = qf[2] = c1;
lf[3] = nf[3] = qf[3] = ++c2;
if (tTd(7, 20))
printf("queuename: trying \"%s\"\n", nf);
if (tTd(7, 20))
printf("queuename: trying \"%s\"\n", nf);
# ifdef QUEUE
if (access(lf, 0) >= 0 || access(qf, 0) >= 0)
# ifdef QUEUE
if (access(lf, 0) >= 0 || access(qf, 0) >= 0)
}
e->e_id = newstr(&qf[2]);
define('i', e->e_id, e);
}
e->e_id = newstr(&qf[2]);
define('i', e->e_id, e);
if (tTd(7, 1))
printf("queuename: assigned id %s, env=%x\n", e->e_id, e);
# ifdef LOG
if (LogLevel > 16)
syslog(LOG_DEBUG, "%s: assigned id", e->e_id);
# endif LOG
if (tTd(7, 1))
printf("queuename: assigned id %s, env=%x\n", e->e_id, e);
# ifdef LOG
if (LogLevel > 16)
syslog(LOG_DEBUG, "%s: assigned id", e->e_id);
# endif LOG
}
if (type == '\0')
return (NULL);
(void) sprintf(buf, "%cf%s", type, e->e_id);
}
if (type == '\0')
return (NULL);
(void) sprintf(buf, "%cf%s", type, e->e_id);
if (tTd(7, 2))
printf("queuename: %s\n", buf);
if (tTd(7, 2))
printf("queuename: %s\n", buf);
ENVELOPE *e;
{
/* remove the transcript */
ENVELOPE *e;
{
/* remove the transcript */
# ifdef LOG
if (LogLevel > 19)
syslog(LOG_DEBUG, "%s: unlock", e->e_id);
# endif LOG
if (!tTd(51, 4))
# ifdef LOG
if (LogLevel > 19)
syslog(LOG_DEBUG, "%s: unlock", e->e_id);
# endif LOG
if (!tTd(51, 4))
xunlink(queuename(e, 'x'));
# ifdef QUEUE
xunlink(queuename(e, 'x'));
# ifdef QUEUE
-static char sccsid[] = "@(#)readcf.c 5.16 (Berkeley) %G%";
+static char sccsid[] = "@(#)readcf.c 5.17 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
** prints rewrite rules.
*/
** prints rewrite rules.
*/
printrules()
{
register struct rewrite *rwp;
printrules()
{
register struct rewrite *rwp;
\f/*
** SETOPTION -- set global processing option
**
\f/*
** SETOPTION -- set global processing option
**
extern bool trusteduser();
extern char *username();
extern bool trusteduser();
extern char *username();
if (tTd(37, 1))
printf("setoption %c=%s", opt, val);
if (tTd(37, 1))
printf("setoption %c=%s", opt, val);
/*
** See if this option is preset for us.
/*
** See if this option is preset for us.
if (bitnset(opt, StickyOpt))
{
if (bitnset(opt, StickyOpt))
{
if (tTd(37, 1))
printf(" (ignored)\n");
if (tTd(37, 1))
printf(" (ignored)\n");
if (tTd(37, 1))
printf("\n");
if (tTd(37, 1))
printf("\n");
-static char sccsid[] = "@(#)recipient.c 5.13 (Berkeley) %G%";
+static char sccsid[] = "@(#)recipient.c 5.14 (Berkeley) %G%";
#endif /* not lint */
# include <pwd.h>
#endif /* not lint */
# include <pwd.h>
ADDRESS *sibl; /* sibling pointer in tree */
ADDRESS *prev; /* previous sibling */
ADDRESS *sibl; /* sibling pointer in tree */
ADDRESS *prev; /* previous sibling */
if (tTd(25, 1))
{
printf("sendto: %s\n ctladdr=", list);
printaddr(ctladdr, FALSE);
}
if (tTd(25, 1))
{
printf("sendto: %s\n ctladdr=", list);
printaddr(ctladdr, FALSE);
}
/* heuristic to determine old versus new style addresses */
if (ctladdr == NULL &&
/* heuristic to determine old versus new style addresses */
if (ctladdr == NULL &&
CurEnv->e_to = a->q_paddr;
m = a->q_mailer;
errno = 0;
CurEnv->e_to = a->q_paddr;
m = a->q_mailer;
errno = 0;
if (tTd(26, 1))
{
printf("\nrecipient: ");
printaddr(a, FALSE);
}
if (tTd(26, 1))
{
printf("\nrecipient: ");
printaddr(a, FALSE);
}
/* break aliasing loops */
if (AliasLevel > MAXRCRSN)
/* break aliasing loops */
if (AliasLevel > MAXRCRSN)
{
if (!ForceMail && sameaddr(q, a))
{
{
if (!ForceMail && sameaddr(q, a))
{
if (tTd(26, 1))
{
printf("%s in sendq: ", a->q_paddr);
printaddr(q, FALSE);
}
if (tTd(26, 1))
{
printf("%s in sendq: ", a->q_paddr);
printaddr(q, FALSE);
}
if (Verbose && !bitset(QDONTSEND|QPSEUDO, a->q_flags))
message(Arpa_Info, "duplicate suppressed");
if (!bitset(QPRIMARY, q->q_flags))
if (Verbose && !bitset(QDONTSEND|QPSEUDO, a->q_flags))
message(Arpa_Info, "duplicate suppressed");
if (!bitset(QPRIMARY, q->q_flags))
-static char sccsid[] = "@(#)savemail.c 5.10 (Berkeley) %G%";
+static char sccsid[] = "@(#)savemail.c 5.11 (Berkeley) %G%";
#endif /* not lint */
# include <pwd.h>
#endif /* not lint */
# include <pwd.h>
extern char *ttypath();
typedef int (*fnptr)();
extern char *ttypath();
typedef int (*fnptr)();
if (tTd(6, 1))
printf("\nsavemail, ErrorMode = %c\n", ErrorMode);
if (tTd(6, 1))
printf("\nsavemail, ErrorMode = %c\n", ErrorMode);
if (bitset(EF_RESPONSE, e->e_flags))
return;
if (bitset(EF_RESPONSE, e->e_flags))
return;
while (state != ESM_DONE)
{
while (state != ESM_DONE)
{
if (tTd(6, 5))
printf(" state %d\n", state);
if (tTd(6, 5))
printf(" state %d\n", state);
static int returndepth;
register ADDRESS *q;
static int returndepth;
register ADDRESS *q;
if (tTd(6, 1))
{
printf("Return To Sender: msg=\"%s\", depth=%d, CurEnv=%x,\n",
if (tTd(6, 1))
{
printf("Return To Sender: msg=\"%s\", depth=%d, CurEnv=%x,\n",
printf("\treturnq=");
printaddr(returnq, TRUE);
}
printf("\treturnq=");
printaddr(returnq, TRUE);
}
if (++returndepth >= MAXRETURNS)
{
if (++returndepth >= MAXRETURNS)
{
-static char sccsid[] = "@(#)stab.c 5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)stab.c 5.6 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
register char *p;
extern char lower();
register char *p;
extern char lower();
if (tTd(36, 5))
printf("STAB: %s %d ", name, type);
if (tTd(36, 5))
printf("STAB: %s %d ", name, type);
/*
** Compute the hashing function
/*
** Compute the hashing function
for (p = name; *p != '\0'; p++)
hfunc = (((hfunc << 7) | lower(*p)) & 077777) % STABSIZE;
for (p = name; *p != '\0'; p++)
hfunc = (((hfunc << 7) | lower(*p)) & 077777) % STABSIZE;
if (tTd(36, 9))
printf("(hfunc=%d) ", hfunc);
if (tTd(36, 9))
printf("(hfunc=%d) ", hfunc);
ps = &SymTab[hfunc];
while ((s = *ps) != NULL && (strcasecmp(name, s->s_name) || s->s_type != type))
ps = &SymTab[hfunc];
while ((s = *ps) != NULL && (strcasecmp(name, s->s_name) || s->s_type != type))
if (s != NULL || op == ST_FIND)
{
if (s != NULL || op == ST_FIND)
{
if (tTd(36, 5))
{
if (s == NULL)
if (tTd(36, 5))
{
if (s == NULL)
s->s_type, lp[0], lp[1], lp[2], lp[3]);
}
}
s->s_type, lp[0], lp[1], lp[2], lp[3]);
}
}
** Make a new entry and link it in.
*/
** Make a new entry and link it in.
*/
if (tTd(36, 5))
printf("entered\n");
if (tTd(36, 5))
printf("entered\n");
/* make new entry */
s = (STAB *) xalloc(sizeof *s);
/* make new entry */
s = (STAB *) xalloc(sizeof *s);
-static char sccsid[] = "@(#)usersmtp.c 5.11 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 5.12 (Berkeley) %G% (with SMTP)";
-static char sccsid[] = "@(#)usersmtp.c 5.11 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 5.12 (Berkeley) %G% (without SMTP)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
** Open the connection to the mailer.
*/
** Open the connection to the mailer.
*/
if (SmtpState == SMTP_OPEN)
syserr("smtpinit: already open");
if (SmtpState == SMTP_OPEN)
syserr("smtpinit: already open");
SmtpIn = SmtpOut = NULL;
SmtpState = SMTP_CLOSED;
SmtpIn = SmtpOut = NULL;
SmtpState = SMTP_CLOSED;
SmtpPid = openmailer(m, pvp, (ADDRESS *) NULL, TRUE, &SmtpOut, &SmtpIn);
if (SmtpPid < 0)
{
SmtpPid = openmailer(m, pvp, (ADDRESS *) NULL, TRUE, &SmtpOut, &SmtpIn);
if (SmtpPid < 0)
{
if (tTd(18, 1))
printf("smtpinit: cannot open %s: stat %d errno %d\n",
pvp[0], ExitStat, errno);
if (tTd(18, 1))
printf("smtpinit: cannot open %s: stat %d errno %d\n",
pvp[0], ExitStat, errno);
if (CurEnv->e_xfp != NULL)
{
register char *p;
if (CurEnv->e_xfp != NULL)
{
register char *p;
# endif ECONNRESET
message(Arpa_TSyserr, "reply: read error");
# endif ECONNRESET
message(Arpa_TSyserr, "reply: read error");
/* if debugging, pause so we can see state */
if (tTd(18, 100))
pause();
/* if debugging, pause so we can see state */
if (tTd(18, 100))
pause();
# ifdef LOG
syslog(LOG_INFO, "%s", &MsgBuf[4]);
# endif LOG
# ifdef LOG
syslog(LOG_INFO, "%s", &MsgBuf[4]);
# endif LOG