summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sendmail
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-11-10 02:05:23 +0000
committerpeter <peter@FreeBSD.org>1997-11-10 02:05:23 +0000
commitd0e38bcf4bd5e3927bc10ebd2568a0bd0bf227c0 (patch)
tree0946e43f76ee6f777e1b536b53d34490bfd984d8 /usr.sbin/sendmail
parent93ede594f272b8bef49a4e4bbcedce5c14eb31a9 (diff)
downloadFreeBSD-src-d0e38bcf4bd5e3927bc10ebd2568a0bd0bf227c0.zip
FreeBSD-src-d0e38bcf4bd5e3927bc10ebd2568a0bd0bf227c0.tar.gz
Merge sendmail 8.8.8 changes onto mainline. (For all of CVS's warts, when
things like this turn out this easy (ie: it took 30 seconds), it's nice :-)
Diffstat (limited to 'usr.sbin/sendmail')
-rw-r--r--usr.sbin/sendmail/cf/cf/knecht.mc5
-rw-r--r--usr.sbin/sendmail/makemap/makemap.c17
-rw-r--r--usr.sbin/sendmail/smrsh/smrsh.c3
-rw-r--r--usr.sbin/sendmail/src/collect.c4
-rw-r--r--usr.sbin/sendmail/src/conf.c22
-rw-r--r--usr.sbin/sendmail/src/conf.h21
-rw-r--r--usr.sbin/sendmail/src/daemon.c39
-rw-r--r--usr.sbin/sendmail/src/deliver.c87
-rw-r--r--usr.sbin/sendmail/src/headers.c20
-rw-r--r--usr.sbin/sendmail/src/main.c50
-rw-r--r--usr.sbin/sendmail/src/parseaddr.c15
-rw-r--r--usr.sbin/sendmail/src/readcf.c12
-rw-r--r--usr.sbin/sendmail/src/recipient.c9
-rw-r--r--usr.sbin/sendmail/src/savemail.c64
-rw-r--r--usr.sbin/sendmail/src/sendmail.h7
-rw-r--r--usr.sbin/sendmail/src/srvrsmtp.c30
-rw-r--r--usr.sbin/sendmail/src/usersmtp.c5
-rw-r--r--usr.sbin/sendmail/src/util.c10
18 files changed, 256 insertions, 164 deletions
diff --git a/usr.sbin/sendmail/cf/cf/knecht.mc b/usr.sbin/sendmail/cf/cf/knecht.mc
index 111ac78..71ae12b 100644
--- a/usr.sbin/sendmail/cf/cf/knecht.mc
+++ b/usr.sbin/sendmail/cf/cf/knecht.mc
@@ -38,7 +38,7 @@ divert(-1)
#
divert(0)dnl
-VERSIONID(`@(#)knecht.mc 8.13 (Berkeley) 7/7/97')
+VERSIONID(`@(#)knecht.mc 8.15 (Berkeley) 10/20/97')
OSTYPE(bsd4.4)dnl
DOMAIN(generic)dnl
define(`confFORWARD_PATH', `$z/.forward.$w:$z/.forward+$h:$z/.forward')dnl
@@ -48,6 +48,7 @@ define(`confTO_ICONNECT', `10s')dnl
define(`confCOPY_ERRORS_TO', `Postmaster')dnl
define(`confTO_QUEUEWARN', `8h')dnl
define(`confPRIVACY_FLAGS', ``authwarnings,noexpn,novrfy'')dnl
+define(`LOCAL_MAILER_FLAGS', `rmn9P')dnl
FEATURE(virtusertable)dnl
MAILER(local)dnl
MAILER(smtp)dnl
@@ -119,7 +120,7 @@ R<FAIL> $* $#error $: 451 Sender domain must resolve
# handle case of no @domain on address
R<?> $* $: < ? $&{client_name} > $1
R<?> $* $@ <OK> ...local unqualed ok
-R<? $+> $* $#error $: 551 Domain name required
+R<? $+> $* $#error $: 550 Domain name required
...remote is not
R<$+> $* $#error $: $1 error from domaincheck
diff --git a/usr.sbin/sendmail/makemap/makemap.c b/usr.sbin/sendmail/makemap/makemap.c
index 8e10907..eb7bf33 100644
--- a/usr.sbin/sendmail/makemap/makemap.c
+++ b/usr.sbin/sendmail/makemap/makemap.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)makemap.c 8.37 (Berkeley) 7/10/97";
+static char sccsid[] = "@(#)makemap.c 8.38 (Berkeley) 9/23/97";
#endif /* not lint */
#include <sys/types.h>
@@ -363,13 +363,6 @@ main(argc, argv)
pbuf, errstring(st));
exit(EX_CANTCREAT);
}
- if (std.st_dev == stp.st_dev && std.st_ino == stp.st_ino)
- {
- fprintf(stderr,
- "%s: cannot run with GDBM\n",
- mapname);
- exit(EX_CONFIG);
- }
break;
#endif
default:
@@ -407,6 +400,14 @@ main(argc, argv)
#ifdef NDBM
case T_DBM:
dbp.dbm = dbm_open(mapname, mode, 0644);
+ if (dbp.dbm != NULL &&
+ dbm_dirfno(dbp.dbm) == dbm_pagfno(dbp.dbm))
+ {
+ fprintf(stderr, "dbm map %s: cannot run with GDBM\n",
+ mapname);
+ dbm_close(dbp.dbm);
+ exit(EX_CONFIG);
+ }
if (!ignoresafeties && dbp.dbm != NULL &&
(filechanged(dbuf, dbm_dirfno(dbp.dbm), &std, sff) ||
filechanged(pbuf, dbm_pagfno(dbp.dbm), &stp, sff)))
diff --git a/usr.sbin/sendmail/smrsh/smrsh.c b/usr.sbin/sendmail/smrsh/smrsh.c
index 49201e9..10ae36b 100644
--- a/usr.sbin/sendmail/smrsh/smrsh.c
+++ b/usr.sbin/sendmail/smrsh/smrsh.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)smrsh.c 8.4 (Berkeley) 11/11/95";
+static char sccsid[] = "@(#)smrsh.c 8.5 (Berkeley) 10/19/97";
#endif /* not lint */
/*
@@ -76,6 +76,7 @@ static char sccsid[] = "@(#)smrsh.c 8.4 (Berkeley) 11/11/95";
#endif
#include <sysexits.h>
#include <syslog.h>
+#include <stdlib.h>
/* directory in which all commands must reside */
#ifndef CMDDIR
diff --git a/usr.sbin/sendmail/src/collect.c b/usr.sbin/sendmail/src/collect.c
index de4ee06..58f0dc7 100644
--- a/usr.sbin/sendmail/src/collect.c
+++ b/usr.sbin/sendmail/src/collect.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)collect.c 8.71 (Berkeley) 6/30/97";
+static char sccsid[] = "@(#)collect.c 8.72 (Berkeley) 10/6/97";
#endif /* not lint */
# include <errno.h>
@@ -567,7 +567,7 @@ readerr:
/* check for message too large */
if (MaxMessageSize > 0 && e->e_msgsize > MaxMessageSize)
{
- e->e_flags |= EF_NO_BODY_RETN;
+ e->e_flags |= EF_NO_BODY_RETN|EF_CLRQUEUE;
e->e_status = "5.2.3";
usrerr("552 Message exceeds maximum fixed size (%ld)",
MaxMessageSize);
diff --git a/usr.sbin/sendmail/src/conf.c b/usr.sbin/sendmail/src/conf.c
index 60502b3..f689137 100644
--- a/usr.sbin/sendmail/src/conf.c
+++ b/usr.sbin/sendmail/src/conf.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)conf.c 8.374 (Berkeley) 8/2/97";
+static char sccsid[] = "@(#)conf.c 8.379 (Berkeley) 10/20/97";
#endif /* not lint */
# include "sendmail.h"
@@ -2063,7 +2063,6 @@ refuseconnections(port)
static time_t lastconn = (time_t) 0;
static int conncnt = 0;
extern bool enoughdiskspace();
- extern void setproctitle __P((const char *, ...));
#ifdef XLA
if (!xla_smtp_ok())
@@ -2222,7 +2221,7 @@ initsetproctitle(argc, argv, envp)
char **argv;
char **envp;
{
- register int i;
+ register int i, envpsize = 0;
extern char **environ;
/*
@@ -2231,7 +2230,7 @@ initsetproctitle(argc, argv, envp)
*/
for (i = 0; envp[i] != NULL; i++)
- continue;
+ envpsize += strlen(envp[i]) + 1;
environ = (char **) xalloc(sizeof (char *) * (i + 1));
for (i = 0; envp[i] != NULL; i++)
environ[i] = newstr(envp[i]);
@@ -2242,6 +2241,16 @@ initsetproctitle(argc, argv, envp)
*/
Argv = argv;
+
+ /*
+ ** Find the last environment variable within sendmail's
+ ** process memory area.
+ */
+ while (i > 0 && (envp[i - 1] < argv[0] ||
+ envp[i - 1] > (argv[argc - 1] +
+ strlen(argv[argc - 1]) + 1 + envpsize)))
+ i--;
+
if (i > 0)
LastArgv = envp[i - 1] + strlen(envp[i - 1]);
else
@@ -2817,6 +2826,7 @@ char *optarg = NULL; /* argument associated with option */
#define tell(s) if (opterr) {fputs(*nargv,stderr);fputs(s,stderr); \
fputc(optopt,stderr);fputc('\n',stderr);return(BADCH);}
+int
getopt(nargc,nargv,ostr)
int nargc;
char *const *nargv;
@@ -2824,7 +2834,7 @@ getopt(nargc,nargv,ostr)
{
static char *place = EMSG; /* option letter processing */
static char atend = 0;
- register char *oli; /* option letter list index */
+ register char *oli = NULL; /* option letter list index */
if (atend) {
atend = 0;
@@ -3840,7 +3850,7 @@ chownsafe(fd, safedir)
bool safedir;
{
#if (!defined(_POSIX_CHOWN_RESTRICTED) || _POSIX_CHOWN_RESTRICTED != -1) && \
- defined(_PC_CHOWN_RESTRICTED)
+ (defined(_PC_CHOWN_RESTRICTED) || defined(_GNU_TYPES_H))
int rval;
/* give the system administrator a chance to override */
diff --git a/usr.sbin/sendmail/src/conf.h b/usr.sbin/sendmail/src/conf.h
index 2da4506..526b751 100644
--- a/usr.sbin/sendmail/src/conf.h
+++ b/usr.sbin/sendmail/src/conf.h
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)conf.h 8.328 (Berkeley) 8/3/97
+ * @(#)conf.h 8.335 (Berkeley) 10/24/97
*/
/*
@@ -294,7 +294,9 @@ typedef int pid_t;
define BSD_REMAP_SIGNAL_TO_SIGVEC
RTisms needed above */
/* make this sendmail in a completely different place */
-# define _PATH_VENDORCF "/usr/local/newmail/sendmail.cf"
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/local/newmail/sendmail.cf"
+# endif
# ifndef _PATH_SENDMAILPID
# define _PATH_SENDMAILPID "/usr/local/newmail/sendmail.pid"
# endif
@@ -348,6 +350,7 @@ typedef int pid_t;
# ifdef IRIX6
# define LA_TYPE LA_IRIX6 /* figure out at run time */
# define SAFENFSPATHCONF 0 /* pathconf(2) lies on NFS filesystems */
+# define SYSLOG_BUFSIZE 512
# else
# define LA_TYPE LA_INT
@@ -382,7 +385,6 @@ typedef int pid_t;
# include <sys/time.h>
# define HASINITGROUPS 1 /* has initgroups(3) call */
# define HASUNAME 1 /* use System V uname(2) system call */
-# define HASGETUSERSHELL 1 /* DOES have getusershell(3) call in libc */
# define HASFCHMOD 1 /* has fchmod(2) syscall */
# define IP_SRCROUTE 1 /* can check IP source routing */
# define SAFENFSPATHCONF 1 /* pathconf(2) pessimizes on NFS filesystems */
@@ -438,6 +440,7 @@ typedef int pid_t;
# else
/* SunOS 4.0.3 or 4.1.x */
+# define HASGETUSERSHELL 1 /* DOES have getusershell(3) call in libc */
# define HASSETREUID 1 /* has setreuid(2) call */
# ifndef HASFLOCK
# define HASFLOCK 1 /* has flock(2) call */
@@ -907,6 +910,7 @@ extern int errno;
#if _SCO_DS >= 1
# include <paths.h>
# define _SCO_unix_4_2
+# define SIOCGIFNUM_IS_BROKEN 1 /* SIOCGIFNUM returns bogus value */
# define HASSNPRINTF 1 /* has snprintf(3) call */
# define HASFCHMOD 1 /* has fchmod(2) call */
# define HASSETRLIMIT 1 /* has setrlimit(2) call */
@@ -1192,6 +1196,7 @@ extern void *malloc();
# define LA_TYPE LA_PROCSTR
# endif
# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() impl */
+# define SPT_PADCHAR '\0' /* pad process title with nulls */
# ifndef _PATH_SENDMAILPID
# define _PATH_SENDMAILPID "/var/run/sendmail.pid"
# endif
@@ -1228,6 +1233,7 @@ extern void *malloc();
# define BSD /* has BSD routines */
# define HASSETRLIMIT 0 /* ... but not setrlimit(2) */
# define BROKEN_RES_SEARCH 1 /* res_search(unknown) returns h_errno=0 */
+# define BOGUS_O_EXCL 1 /* exclusive open follows symlinks */
# define HASUNAME 1 /* use System V uname(2) system call */
# define HASFCHMOD 1 /* has fchmod(2) syscall */
# define HASINITGROUPS 1 /* has initgroups(3) call */
@@ -1840,6 +1846,15 @@ typedef struct msgb mblk_t;
# undef offsetof /* avoid stddefs.h and sys/sysmacros.h conflict */
#endif
+/*
+** Siemens Nixdorf Informationssysteme AG SINIX
+**
+** Contributed by Gerald Rinske <Gerald.Rinske@mch.sni.de>
+** of Siemens Business Services VAS.
+*/
+#ifdef _sinix_
+# define SYSLOG_BUFSIZE 1024
+#endif
/**********************************************************************
** End of Per-Operating System defines
diff --git a/usr.sbin/sendmail/src/daemon.c b/usr.sbin/sendmail/src/daemon.c
index bc8fd6f..e62aaf1 100644
--- a/usr.sbin/sendmail/src/daemon.c
+++ b/usr.sbin/sendmail/src/daemon.c
@@ -37,9 +37,9 @@
#ifndef lint
#ifdef DAEMON
-static char sccsid[] = "@(#)daemon.c 8.186 (Berkeley) 8/2/97 (with daemon mode)";
+static char sccsid[] = "@(#)daemon.c 8.195 (Berkeley) 10/23/97 (with daemon mode)";
#else
-static char sccsid[] = "@(#)daemon.c 8.186 (Berkeley) 8/2/97 (without daemon mode)";
+static char sccsid[] = "@(#)daemon.c 8.195 (Berkeley) 10/23/97 (without daemon mode)";
#endif
#endif /* not lint */
@@ -103,9 +103,7 @@ static char sccsid[] = "@(#)daemon.c 8.186 (Berkeley) 8/2/97 (without daemon mod
** e -- the current envelope.
**
** Returns:
-** TRUE -- if a "null server" should be used -- that is, one
-** that rejects all commands.
-** FALSE -- to use a normal server.
+** none.
**
** Side Effects:
** Waits until some interesting activity occurs. When
@@ -122,7 +120,7 @@ int ListenQueueSize = 10; /* size of listen queue */
int TcpRcvBufferSize = 0; /* size of TCP receive buffer */
int TcpSndBufferSize = 0; /* size of TCP send buffer */
-bool
+void
getrequests(e)
ENVELOPE *e;
{
@@ -188,7 +186,7 @@ getrequests(e)
*/
if (tTd(15, 1))
- printf("getrequests: port 0x%x\n", DaemonAddr.sin.sin_port);
+ printf("getrequests: port 0x%x\n", port);
/* get a socket for the SMTP connection */
socksize = opendaemonsocket(TRUE);
@@ -238,7 +236,7 @@ getrequests(e)
/* see if we are rejecting connections */
(void) blocksignal(SIGALRM);
- if (refuseconnections(ntohs(DaemonAddr.sin.sin_port)))
+ if (refuseconnections(ntohs(port)))
{
if (DaemonSocket >= 0)
{
@@ -284,7 +282,7 @@ getrequests(e)
/* wait for a connection */
setproctitle("accepting connections on port %d",
- ntohs(DaemonAddr.sin.sin_port));
+ ntohs(port));
#if 0
/*
** Andrew Sun <asun@ieps-sun.ml.com> claims that this will
@@ -372,7 +370,6 @@ getrequests(e)
char *p;
extern SIGFUNC_DECL intsig __P((int));
FILE *inchannel, *outchannel;
- bool nullconn;
/*
** CHILD -- return to caller.
@@ -437,13 +434,6 @@ getrequests(e)
/* open maps for check_relay ruleset */
initmaps(FALSE, e);
- /* validate the connection */
- HoldErrs = TRUE;
- nullconn = !validate_connection(&RealHostAddr, RealHostName, e);
- HoldErrs = FALSE;
- if (nullconn)
- break;
-
#ifdef XLA
if (!xla_host_ok(RealHostName))
{
@@ -452,9 +442,7 @@ getrequests(e)
}
#endif
- if (tTd(15, 2))
- printf("getreq: returning (normal server)\n");
- return FALSE;
+ break;
}
/* parent -- keep track of children */
@@ -473,8 +461,8 @@ getrequests(e)
(void) close(pipefd[1]);
}
if (tTd(15, 2))
- printf("getreq: returning (null server)\n");
- return TRUE;
+ printf("getreq: returning\n");
+ return;
}
/*
** OPENDAEMONSOCKET -- open the SMTP socket
@@ -1265,7 +1253,7 @@ getauthinfo(fd)
int nleft;
struct hostent *hp;
char **ha;
- bool may_be_forged;
+ volatile bool may_be_forged;
char ibuf[MAXNAME + 1];
static char hbuf[MAXNAME * 2 + 2];
@@ -1750,6 +1738,7 @@ host_map_lookup(map, name, av, statp)
}
/* found a match -- copy out */
+ hp->h_name = denlstring((char *) hp->h_name, TRUE, TRUE);
s->s_namecanon.nc_stat = *statp = EX_OK;
s->s_namecanon.nc_cname = newstr(hp->h_name);
if (bitset(MF_MATCHONLY, map->map_mflags))
@@ -2027,7 +2016,9 @@ hostnamebyanyaddr(sap)
#endif /* NAMED_BIND */
if (hp != NULL && hp->h_name[0] != '[')
- return (char *) hp->h_name;
+ return denlstring((char *) hp->h_name, TRUE, TRUE);
+ else if (sap->sa.sa_family == AF_UNIX && sap->sunix.sun_path[0] == '\0')
+ return "localhost";
else
{
/* produce a dotted quad */
diff --git a/usr.sbin/sendmail/src/deliver.c b/usr.sbin/sendmail/src/deliver.c
index 8805ab9..9575515 100644
--- a/usr.sbin/sendmail/src/deliver.c
+++ b/usr.sbin/sendmail/src/deliver.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)deliver.c 8.285 (Berkeley) 8/2/97";
+static char sccsid[] = "@(#)deliver.c 8.296 (Berkeley) 10/22/97";
#endif /* not lint */
#include "sendmail.h"
@@ -44,6 +44,10 @@ static char sccsid[] = "@(#)deliver.c 8.285 (Berkeley) 8/2/97";
extern int h_errno;
#endif
+#if HASSETUSERCONTEXT
+# include <login_cap.h>
+#endif
+
#if SMTP
extern char SmtpError[];
#endif
@@ -77,7 +81,7 @@ sendall(e, mode)
register ENVELOPE *ee;
ENVELOPE *splitenv = NULL;
int oldverbose = Verbose;
- bool somedeliveries = FALSE;
+ bool somedeliveries = FALSE, expensive = FALSE;
pid_t pid;
extern void sendenvelope();
@@ -281,6 +285,7 @@ sendall(e, mode)
if (tTd(13, 30))
printf(" ... expensive\n");
q->q_flags |= QQUEUEUP;
+ expensive = TRUE;
}
else
{
@@ -393,11 +398,13 @@ sendall(e, mode)
/* treat this as a delivery in terms of counting tries */
e->e_dtime = curtime();
- e->e_ntries++;
+ if (!expensive)
+ e->e_ntries++;
for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
{
ee->e_dtime = curtime();
- ee->e_ntries++;
+ if (!expensive)
+ ee->e_ntries++;
}
}
@@ -466,34 +473,13 @@ sendall(e, mode)
/*
** Since fcntl locking has the interesting semantic that
** the lock is owned by a process, not by an open file
- ** descriptor, we have to flush this to the queue, and
+ ** descriptor, we have to unlock this envelope, and
** then restart from scratch in the child.
*/
- {
- /* save id for future use */
- char *qid = e->e_id;
-
- /* now drop the envelope in the parent */
- e->e_flags |= EF_INQUEUE;
- dropenvelope(e, FALSE);
-
- /* arrange to reacquire lock after fork */
- e->e_id = qid;
- }
-
+ unlockqueue(e);
for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
- {
- /* save id for future use */
- char *qid = ee->e_id;
-
- /* drop envelope in parent */
- ee->e_flags |= EF_INQUEUE;
- dropenvelope(ee, FALSE);
-
- /* and save qid for reacquisition */
- ee->e_id = qid;
- }
+ unlockqueue(ee);
# endif /* !HASFLOCK */
@@ -1368,7 +1354,7 @@ tryhost:
hostbuf, m->m_name);
else
message("Connecting to %s port %d via %s...",
- hostbuf, port, m->m_name);
+ hostbuf, ntohs(port), m->m_name);
i = makeconnection(hostbuf, port, mci, e);
mci->mci_lastuse = curtime();
mci->mci_exitstat = i;
@@ -1901,7 +1887,7 @@ tryhost:
for (to = tochain; to != NULL; to = to->q_tchain)
{
e->e_to = to->q_paddr;
- if (strlen(to->q_paddr) + (t - tobuf) + 2 >= sizeof tobuf)
+ if (strlen(to->q_paddr) + (t - tobuf) + 2 > sizeof tobuf)
{
/* not enough room */
continue;
@@ -2244,6 +2230,8 @@ endmailer(mci, e, pv)
{
int st;
+ mci_unlock_host(mci);
+
/* close any connections */
if (mci->mci_in != NULL)
(void) xfclose(mci->mci_in, mci->mci_mailer->m_name, "mci_in");
@@ -2331,6 +2319,9 @@ giveresponse(stat, m, mci, ctladdr, xstart, e)
extern int N_SysEx;
char buf[MAXLINE];
+ if (e == NULL)
+ syserr("giveresponse: null envelope");
+
/*
** Compute status message from code.
*/
@@ -2428,7 +2419,8 @@ giveresponse(stat, m, mci, ctladdr, xstart, e)
** that.
*/
- if (LogLevel > ((stat == EX_TEMPFAIL) ? 8 : (stat == EX_OK) ? 7 : 6))
+ if (OpMode != MD_VERIFY && !bitset(EF_VRFYONLY, e->e_flags) &&
+ LogLevel > ((stat == EX_TEMPFAIL) ? 8 : (stat == EX_OK) ? 7 : 6))
logdelivery(m, mci, &statmsg[4], ctladdr, xstart, e);
if (tTd(11, 2))
@@ -2741,7 +2733,7 @@ putfromline(mci, e)
}
}
expand(template, buf, sizeof buf, e);
- putxline(buf, strlen(buf), mci, PXLF_NOTHINGSPECIAL);
+ putxline(buf, strlen(buf), mci, PXLF_HEADER);
}
/*
** PUTBODY -- put the body of a message.
@@ -3096,17 +3088,21 @@ endofmessage:
** none.
*/
+static jmp_buf CtxMailfileTimeout;
+static void mailfiletimeout();
+
int
mailfile(filename, ctladdr, sfflags, e)
- char *filename;
+ char *volatile filename;
ADDRESS *ctladdr;
- int sfflags;
+ volatile int sfflags;
register ENVELOPE *e;
{
register FILE *f;
register pid_t pid = -1;
- int mode = ST_MODE_NOFILE;
+ volatile int mode = ST_MODE_NOFILE;
bool suidwarn = geteuid() == 0;
+ EVENT *ev;
if (tTd(11, 1))
{
@@ -3140,7 +3136,7 @@ mailfile(filename, ctladdr, sfflags, e)
/* child -- actually write to file */
struct stat stb;
MCI mcibuf;
- int oflags = O_WRONLY|O_APPEND;
+ volatile int oflags = O_WRONLY|O_APPEND;
if (e->e_lockfp != NULL)
(void) close(fileno(e->e_lockfp));
@@ -3152,6 +3148,16 @@ mailfile(filename, ctladdr, sfflags, e)
e->e_to = filename;
ExitStat = EX_OK;
+ if (setjmp(CtxMailfileTimeout) != 0)
+ {
+ exit(EX_TEMPFAIL);
+ }
+
+ if (TimeOuts.to_fileopen > 0)
+ ev = setevent(TimeOuts.to_fileopen, mailfiletimeout, 0);
+ else
+ ev = NULL;
+
#ifdef HASLSTAT
if (lstat(filename, &stb) < 0)
#else
@@ -3287,6 +3293,9 @@ mailfile(filename, ctladdr, sfflags, e)
exit(EX_CANTCREAT);
}
+ if (ev != NULL)
+ clrevent(ev);
+
bzero(&mcibuf, sizeof mcibuf);
mcibuf.mci_mailer = FileMailer;
mcibuf.mci_out = f;
@@ -3332,6 +3341,12 @@ mailfile(filename, ctladdr, sfflags, e)
}
return EX_UNAVAILABLE; /* avoid compiler warning on IRIX */
}
+
+static void
+mailfiletimeout()
+{
+ longjmp(CtxMailfileTimeout, 1);
+}
/*
** HOSTSIGNATURE -- return the "signature" for a host.
**
diff --git a/usr.sbin/sendmail/src/headers.c b/usr.sbin/sendmail/src/headers.c
index ac67f2c..8d18430 100644
--- a/usr.sbin/sendmail/src/headers.c
+++ b/usr.sbin/sendmail/src/headers.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)headers.c 8.111 (Berkeley) 7/9/97";
+static char sccsid[] = "@(#)headers.c 8.115 (Berkeley) 10/22/97";
#endif /* not lint */
# include <errno.h>
@@ -522,9 +522,16 @@ eatheader(e, full)
(void) sendtolist(h->h_value, NULLADDR,
&e->e_sendqueue, 0, e);
+#if 0
+ /*
+ ** Change functionality so a fatal error on an
+ ** address doesn't affect the entire envelope.
+ */
+
/* delete fatal errors generated by this address */
- if (!GrabTo && !bitset(EF_FATALERRS, saveflags))
+ if (!bitset(EF_FATALERRS, saveflags))
e->e_flags &= ~EF_FATALERRS;
+#endif
}
/* save the message-id for logging */
@@ -1330,7 +1337,7 @@ put_vanilla_header(h, v, mci)
int putflags;
char obuf[MAXLINE];
- putflags = 0;
+ putflags = PXLF_HEADER;
#if _FFR_7BITHDRS
if (bitnset(M_7BITHDRS, mci->mci_mailer->m_flags))
putflags |= PXLF_STRIP8BIT;
@@ -1342,8 +1349,8 @@ put_vanilla_header(h, v, mci)
int l;
l = nlp - v;
- if (sizeof obuf - (obp - obuf) < l)
- l = sizeof obuf - (obp - obuf);
+ if (SPACELEFT(obuf, obp) - 1 < l)
+ l = SPACELEFT(obuf, obp) - 1;
snprintf(obp, SPACELEFT(obuf, obp), "%.*s", l, v);
putxline(obuf, strlen(obuf), mci, putflags);
@@ -1385,7 +1392,7 @@ commaize(h, p, oldstyle, mci, e)
int opos;
int omax;
bool firstone = TRUE;
- int putflags = 0;
+ int putflags = PXLF_HEADER;
char obuf[MAXLINE + 3];
/*
@@ -1491,6 +1498,7 @@ commaize(h, p, oldstyle, mci, e)
*p = savechar;
continue;
}
+ name = denlstring(name, FALSE, TRUE);
/* output the name with nice formatting */
opos += strlen(name);
diff --git a/usr.sbin/sendmail/src/main.c b/usr.sbin/sendmail/src/main.c
index 61c54e7..9dd8a6a 100644
--- a/usr.sbin/sendmail/src/main.c
+++ b/usr.sbin/sendmail/src/main.c
@@ -39,7 +39,7 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 8.249 (Berkeley) 7/25/97";
+static char sccsid[] = "@(#)main.c 8.258 (Berkeley) 10/20/97";
#endif /* not lint */
#define _DEFINE
@@ -50,10 +50,6 @@ static char sccsid[] = "@(#)main.c 8.249 (Berkeley) 7/25/97";
#include <resolv.h>
#endif
-# ifdef lint
-char edata, end;
-# endif /* lint */
-
/*
** SENDMAIL -- Post mail to a set of destinations.
**
@@ -122,7 +118,6 @@ main(argc, argv, envp)
char **av;
extern char Version[];
char *ep, *from;
- typedef int (*fnptr)();
STAB *st;
register int i;
int j;
@@ -133,7 +128,6 @@ main(argc, argv, envp)
bool run_in_foreground = FALSE; /* -bD mode */
static bool reenter = FALSE;
struct passwd *pw;
- struct stat stb;
struct hostent *hp;
bool nullserver = FALSE;
char jbuf[MAXHOSTNAMELEN]; /* holds MyHostName */
@@ -436,6 +430,8 @@ main(argc, argv, envp)
res_init();
if (tTd(8, 8))
_res.options |= RES_DEBUG;
+ else
+ _res.options &= ~RES_DEBUG;
# ifdef RES_NOALIASES
_res.options |= RES_NOALIASES;
# endif
@@ -832,6 +828,15 @@ main(argc, argv, envp)
ConfigFileRead = TRUE;
vendor_post_defaults(CurEnv);
+ /* Enforce use of local time (null string overrides this) */
+ if (TimeZoneSpec == NULL)
+ unsetenv("TZ");
+ else if (TimeZoneSpec[0] != '\0')
+ setuserenv("TZ", TimeZoneSpec);
+ else
+ setuserenv("TZ", NULL);
+ tzset();
+
/* avoid denial-of-service attacks */
resetlimits();
@@ -903,15 +908,6 @@ main(argc, argv, envp)
if (DefaultNotify == 0)
DefaultNotify = QPINGONFAILURE|QPINGONDELAY;
- /* Enforce use of local time (null string overrides this) */
- if (TimeZoneSpec == NULL)
- unsetenv("TZ");
- else if (TimeZoneSpec[0] != '\0')
- setuserenv("TZ", TimeZoneSpec);
- else
- setuserenv("TZ", NULL);
- tzset();
-
/* be sure we don't pick up bogus HOSTALIASES environment variable */
if (queuemode && RealUid != 0)
(void) unsetenv("HOSTALIASES");
@@ -1321,7 +1317,7 @@ main(argc, argv, envp)
if (OpMode == MD_DAEMON || QueueIntvl != 0)
{
char dtype[200];
- extern bool getrequests __P((ENVELOPE *));
+ extern void getrequests __P((ENVELOPE *));
if (!run_in_foreground && !tTd(99, 100))
{
@@ -1371,7 +1367,7 @@ main(argc, argv, envp)
dropenvelope(CurEnv, TRUE);
#if DAEMON
- nullserver = getrequests(CurEnv);
+ getrequests(CurEnv);
/* drop privileges */
(void) drop_privileges(FALSE);
@@ -1385,6 +1381,11 @@ main(argc, argv, envp)
p = getauthinfo(fileno(InChannel));
define('_', p, &BlankEnvelope);
+
+ /* validate the connection */
+ HoldErrs = TRUE;
+ nullserver = !validate_connection(&RealHostAddr, RealHostName, CurEnv);
+ HoldErrs = FALSE;
#endif /* DAEMON */
}
@@ -1476,10 +1477,9 @@ main(argc, argv, envp)
CurEnv->e_flags &= ~EF_FATALERRS;
collect(InChannel, FALSE, NULL, CurEnv);
- /* bail out if there were fatal errors in collect */
- if (OpMode != MD_VERIFY && bitset(EF_FATALERRS, CurEnv->e_flags))
+ /* bail out if message too large */
+ if (bitset(EF_CLRQUEUE, CurEnv->e_flags))
{
- CurEnv->e_flags |= EF_CLRQUEUE;
finis();
/*NOTREACHED*/
return -1;
@@ -2047,7 +2047,7 @@ sighup(sig)
RunAsUid, RunAsGid);
exit(EX_OSERR);
}
- execv(SaveArgv[0], (ARGV_T) SaveArgv);
+ execve(SaveArgv[0], (ARGV_T) SaveArgv, (ARGV_T) ExternalEnviron);
if (LogLevel > 0)
sm_syslog(LOG_ALERT, NOQID, "could not exec %s: %m", SaveArgv[0]);
exit(EX_OSFILE);
@@ -2089,14 +2089,14 @@ drop_privileges(to_real_uid)
#ifdef NGROUPS_MAX
/* reset group permissions; these can be set later */
- emptygidset[0] = RunAsGid == 0 ? getegid() : RunAsGid;
+ emptygidset[0] = (to_real_uid || RunAsGid != 0) ? RunAsGid : getegid();
(void) setgroups(1, emptygidset);
#endif
/* reset primary group and user id */
- if (RunAsGid != 0 && setgid(RunAsGid) < 0)
+ if ((to_real_uid || RunAsGid != 0) && setgid(RunAsGid) < 0)
rval = EX_OSERR;
- if (RunAsUid != 0 && setuid(RunAsUid) < 0)
+ if ((to_real_uid || RunAsUid != 0) && setuid(RunAsUid) < 0)
rval = EX_OSERR;
return rval;
}
diff --git a/usr.sbin/sendmail/src/parseaddr.c b/usr.sbin/sendmail/src/parseaddr.c
index 75b9089..7831834 100644
--- a/usr.sbin/sendmail/src/parseaddr.c
+++ b/usr.sbin/sendmail/src/parseaddr.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)parseaddr.c 8.130 (Berkeley) 8/2/97";
+static char sccsid[] = "@(#)parseaddr.c 8.132 (Berkeley) 10/20/97";
#endif /* not lint */
# include "sendmail.h"
@@ -1859,6 +1859,7 @@ struct qflags AddressFlags[] =
{ "QDELIVERED", QDELIVERED },
{ "QDELAYED", QDELAYED },
{ "QTHISPASS", QTHISPASS },
+ { "QRCPTOK", QRCPTOK },
{ NULL }
};
@@ -2136,7 +2137,11 @@ maplocaluser(a, sendq, aliaslevel, e)
}
pvp = prescan(a->q_user, '\0', pvpbuf, sizeof pvpbuf, &delimptr, NULL);
if (pvp == NULL)
+ {
+ if (tTd(29, 9))
+ printf("maplocaluser: cannot prescan %s\n", a->q_user);
return;
+ }
define('h', a->q_host, e);
define('u', a->q_user, e);
@@ -2144,17 +2149,25 @@ maplocaluser(a, sendq, aliaslevel, e)
if (rewrite(pvp, 5, 0, e) == EX_TEMPFAIL)
{
+ if (tTd(29, 9))
+ printf("maplocaluser: rewrite tempfail\n");
a->q_flags |= QQUEUEUP;
a->q_status = "4.4.3";
return;
}
if (pvp[0] == NULL || (pvp[0][0] & 0377) != CANONNET)
+ {
+ if (tTd(29, 9))
+ printf("maplocaluser: doesn't resolve\n");
return;
+ }
/* if non-null, mailer destination specified -- has it changed? */
a1 = buildaddr(pvp, NULL, 0, e);
if (a1 == NULL || sameaddr(a, a1))
{
+ if (tTd(29, 9))
+ printf("maplocaluser: address unchanged\n");
if (a1 != NULL)
free(a1);
return;
diff --git a/usr.sbin/sendmail/src/readcf.c b/usr.sbin/sendmail/src/readcf.c
index a8c82f7..842f80c 100644
--- a/usr.sbin/sendmail/src/readcf.c
+++ b/usr.sbin/sendmail/src/readcf.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)readcf.c 8.200 (Berkeley) 8/2/97";
+static char sccsid[] = "@(#)readcf.c 8.201 (Berkeley) 10/1/97";
#endif /* not lint */
# include "sendmail.h"
@@ -1521,6 +1521,10 @@ struct optioninfo
#define O_DONTLOCK 0xa5
{ "DontLockFilesForRead", O_DONTLOCK, FALSE },
#endif
+#if _FFR_MAXALIASRECURSION_OPTION
+#define O_MAXALIASRCSN 0xa6
+ { "MaxAliasRecursion", O_MAXALIASRCSN, FALSE },
+#endif
{ NULL, '\0', FALSE }
};
@@ -2355,6 +2359,12 @@ setoption(opt, val, safe, sticky, e)
break;
#endif
+#if _FFR_MAXALIASRECURSION_OPTION
+ case O_MAXALIASRCSN:
+ MaxAliasRecursion = atoi(val);
+ break;
+#endif
+
default:
if (tTd(37, 1))
{
diff --git a/usr.sbin/sendmail/src/recipient.c b/usr.sbin/sendmail/src/recipient.c
index 2076884..adcce7a 100644
--- a/usr.sbin/sendmail/src/recipient.c
+++ b/usr.sbin/sendmail/src/recipient.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)recipient.c 8.130 (Berkeley) 5/29/97";
+static char sccsid[] = "@(#)recipient.c 8.133 (Berkeley) 10/19/97";
#endif /* not lint */
# include "sendmail.h"
@@ -263,6 +263,7 @@ recipient(a, sendq, aliaslevel, e)
/* break aliasing loops */
if (aliaslevel > MaxAliasRecursion)
{
+ a->q_flags |= QBADADDR;
a->q_status = "5.4.6";
usrerr("554 aliasing/forwarding loop broken (%d aliases deep; %d max)",
aliaslevel, MaxAliasRecursion);
@@ -327,7 +328,7 @@ recipient(a, sendq, aliaslevel, e)
for (pq = sendq; (q = *pq) != NULL; pq = &q->q_next)
{
- if (sameaddr(q, a))
+ if (sameaddr(q, a) && bitset(QRCPTOK, q->q_flags))
{
if (tTd(26, 1))
{
@@ -641,7 +642,7 @@ recipient(a, sendq, aliaslevel, e)
a->q_paddr);
}
}
-
+ a->q_flags |= QRCPTOK;
return (a);
}
/*
@@ -922,7 +923,7 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
volatile int sfflags = SFF_REGONLY;
register char *p;
bool safechown = FALSE;
- bool safedir = FALSE;
+ volatile bool safedir = FALSE;
struct stat st;
char buf[MAXLINE];
extern bool chownsafe();
diff --git a/usr.sbin/sendmail/src/savemail.c b/usr.sbin/sendmail/src/savemail.c
index 40ad883..8abb524 100644
--- a/usr.sbin/sendmail/src/savemail.c
+++ b/usr.sbin/sendmail/src/savemail.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)savemail.c 8.114 (Berkeley) 8/2/97";
+static char sccsid[] = "@(#)savemail.c 8.121 (Berkeley) 10/22/97";
#endif /* not lint */
# include "sendmail.h"
@@ -85,7 +85,6 @@ savemail(e, sendbody)
int flags;
char buf[MAXLINE+1];
extern char *ttypath();
- typedef int (*fnptr)();
extern bool writable();
if (tTd(6, 1))
@@ -254,8 +253,29 @@ savemail(e, sendbody)
}
if (!emptyaddr(&e->e_from))
{
- (void) sendtolist(e->e_from.q_paddr,
- NULLADDR, &e->e_errorqueue, 0, e);
+ char from[TOBUFSIZE];
+ extern bool pruneroute __P((char *));
+
+ if (strlen(e->e_from.q_paddr) + 1 > sizeof from)
+ {
+ state = ESM_POSTMASTER;
+ break;
+ }
+ strcpy(from, e->e_from.q_paddr);
+
+ if (!DontPruneRoutes && pruneroute(from))
+ {
+ ADDRESS *a;
+
+ for (a = e->e_errorqueue; a != NULL;
+ a = a->q_next)
+ {
+ if (sameaddr(a, &e->e_from))
+ a->q_flags |= QDONTSEND;
+ }
+ }
+ (void) sendtolist(from, NULLADDR,
+ &e->e_errorqueue, 0, e);
}
/*
@@ -379,7 +399,7 @@ savemail(e, sendbody)
break;
}
- flags = SFF_NOLINK|SFF_CREAT|SFF_REGONLY|SFF_OPENASROOT|SFF_MUSTOWN;
+ flags = SFF_NOLINK|SFF_CREAT|SFF_REGONLY|SFF_ROOTOK|SFF_OPENASROOT|SFF_MUSTOWN;
if (!writable(DeadLetterDrop, NULL, flags) ||
(fp = safefopen(DeadLetterDrop, O_WRONLY|O_APPEND,
FileMode, flags)) == NULL)
@@ -519,26 +539,12 @@ returntosender(msg, returnq, flags, e)
initsys(ee);
for (q = returnq; q != NULL; q = q->q_next)
{
- extern bool pruneroute __P((char *));
-
if (bitset(QBADADDR, q->q_flags))
continue;
q->q_flags &= ~(QHASNOTIFY|Q_PINGFLAGS);
q->q_flags |= QPINGONFAILURE;
- if (!DontPruneRoutes && pruneroute(q->q_paddr))
- {
- register ADDRESS *p;
-
- parseaddr(q->q_paddr, q, RF_COPYPARSE, '\0', NULL, e);
- for (p = returnq; p != NULL; p = p->q_next)
- {
- if (p != q && sameaddr(p, q))
- q->q_flags |= QDONTSEND;
- }
- }
-
if (!bitset(QDONTSEND, q->q_flags))
ee->e_nrcpts++;
@@ -650,7 +656,7 @@ returntosender(msg, returnq, flags, e)
return 0;
for (q = ee->e_sendqueue; q != NULL; q = q->q_next)
{
- if (bitset(QSENT, q->q_flags))
+ if (bitset(QQUEUEUP|QSENT, q->q_flags))
return 0;
}
return -1;
@@ -681,7 +687,7 @@ errbody(mci, e, separator)
{
register FILE *xfile;
char *p;
- register ADDRESS *q;
+ register ADDRESS *q = NULL;
bool printheader;
bool sendbody;
bool pm_notify;
@@ -1001,17 +1007,23 @@ errbody(mci, e, separator)
p = "rfc822";
for (r = q; r->q_alias != NULL; r = r->q_alias)
continue;
- if (strchr(r->q_user, '@') == NULL)
+ if (strchr(r->q_user, '@') != NULL)
{
(void) snprintf(buf, sizeof buf,
- "Final-Recipient: %s; %.700s@%.100s",
- p, r->q_user, MyHostName);
+ "Final-Recipient: %s; %.800s",
+ p, r->q_user);
}
- else
+ else if (strchr(r->q_paddr, '@') != NULL)
{
(void) snprintf(buf, sizeof buf,
"Final-Recipient: %s; %.800s",
- p, r->q_user);
+ p, r->q_paddr);
+ }
+ else
+ {
+ (void) snprintf(buf, sizeof buf,
+ "Final-Recipient: %s; %.700s@%.100s",
+ p, r->q_user, MyHostName);
}
putline(buf, mci);
diff --git a/usr.sbin/sendmail/src/sendmail.h b/usr.sbin/sendmail/src/sendmail.h
index 00559ea..fc3bf49 100644
--- a/usr.sbin/sendmail/src/sendmail.h
+++ b/usr.sbin/sendmail/src/sendmail.h
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)sendmail.h 8.242 (Berkeley) 8/2/97
+ * @(#)sendmail.h 8.245 (Berkeley) 10/22/97
*/
/*
@@ -41,7 +41,7 @@
# ifdef _DEFINE
# define EXTERN
# ifndef lint
-static char SmailSccsId[] = "@(#)sendmail.h 8.242 8/2/97";
+static char SmailSccsId[] = "@(#)sendmail.h 8.245 10/22/97";
# endif
# else /* _DEFINE */
# define EXTERN extern
@@ -206,6 +206,7 @@ typedef struct address ADDRESS;
# define QDELIVERED 0x00040000 /* DSN: successful final delivery */
# define QDELAYED 0x00080000 /* DSN: message delayed */
# define QTHISPASS 0x40000000 /* temp: address set this pass */
+# define QRCPTOK 0x80000000 /* recipient() processed address */
# define Q_PINGFLAGS (QPINGONSUCCESS|QPINGONFAILURE|QPINGONDELAY)
@@ -928,6 +929,7 @@ EXTERN int NoRecipientAction;
#define PXLF_NOTHINGSPECIAL 0 /* no special mapping */
#define PXLF_MAPFROM 0x0001 /* map From_ to >From_ */
#define PXLF_STRIP8BIT 0x0002 /* strip 8th bit */
+#define PXLF_HEADER 0x0004 /* map newlines in headers */
/*
** Additional definitions
*/
@@ -1231,7 +1233,6 @@ EXTERN int MaxRuleRecursion; /* maximum depth of ruleset recursion */
EXTERN char *MustQuoteChars; /* quote these characters in phrases */
EXTERN char *ServiceSwitchFile; /* backup service switch */
EXTERN char *DefaultCharSet; /* default character set for MIME */
-EXTERN int DeliveryNiceness; /* how nice to be during delivery */
EXTERN char *PostMasterCopy; /* address to get errs cc's */
EXTERN int CheckpointInterval; /* queue file checkpoint interval */
EXTERN bool DontPruneRoutes; /* don't prune source routes */
diff --git a/usr.sbin/sendmail/src/srvrsmtp.c b/usr.sbin/sendmail/src/srvrsmtp.c
index 3255e83..cd47d5d 100644
--- a/usr.sbin/sendmail/src/srvrsmtp.c
+++ b/usr.sbin/sendmail/src/srvrsmtp.c
@@ -36,9 +36,9 @@
#ifndef lint
#if SMTP
-static char sccsid[] = "@(#)srvrsmtp.c 8.154 (Berkeley) 8/2/97 (with SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.159 (Berkeley) 10/19/97 (with SMTP)";
#else
-static char sccsid[] = "@(#)srvrsmtp.c 8.154 (Berkeley) 8/2/97 (without SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.159 (Berkeley) 10/19/97 (without SMTP)";
#endif
#endif /* not lint */
@@ -153,7 +153,7 @@ smtp(nullserver, e)
volatile int n_noop = 0; /* count of NOOP/VERB/ONEX etc cmds */
volatile int n_helo = 0; /* count of HELO/EHLO commands */
bool ok;
- int lognullconnection = TRUE;
+ volatile int lognullconnection = TRUE;
register char *q;
char inp[MAXLINE];
char cmdbuf[MAXLINE];
@@ -252,6 +252,18 @@ smtp(nullserver, e)
sm_syslog(LOG_NOTICE, e->e_id,
"lost input channel from %.100s",
CurSmtpClient);
+ if (lognullconnection && LogLevel > 5)
+ sm_syslog(LOG_INFO, NULL,
+ "Null connection from %.100s",
+ CurSmtpClient);
+
+ /*
+ ** If have not accepted mail (DATA), do not bounce
+ ** bad addresses back to sender.
+ */
+ if (bitset(EF_CLRQUEUE, e->e_flags))
+ e->e_sendqueue = NULL;
+
if (InChild)
ExitStat = EX_QUIT;
finis();
@@ -872,6 +884,7 @@ smtp(nullserver, e)
shortenstring(inp, 203));
if (setjmp(TopFrame) > 0)
goto undo_subproc;
+ QuickAbort = TRUE;
vrfyqueue = NULL;
if (vrfy)
e->e_flags |= EF_VRFYONLY;
@@ -917,16 +930,17 @@ smtp(nullserver, e)
/* crude way to avoid denial-of-service attacks */
checksmtpattack(&n_etrn, MAXETRNCOMMANDS, "ETRN", e);
+ if (LogLevel > 5)
+ sm_syslog(LOG_INFO, e->e_id,
+ "%.100s: ETRN %s",
+ CurSmtpClient,
+ shortenstring(p, 203));
+
id = p;
if (*id == '@')
id++;
else
*--id = '@';
- if (LogLevel > 5)
- sm_syslog(LOG_INFO, e->e_id,
- "%.100s: ETRN %s",
- CurSmtpClient,
- shortenstring(id, 203));
QueueLimitRecipient = id;
ok = runqueue(TRUE, TRUE);
QueueLimitRecipient = NULL;
diff --git a/usr.sbin/sendmail/src/usersmtp.c b/usr.sbin/sendmail/src/usersmtp.c
index 8529497..cced2f7 100644
--- a/usr.sbin/sendmail/src/usersmtp.c
+++ b/usr.sbin/sendmail/src/usersmtp.c
@@ -36,9 +36,9 @@
#ifndef lint
#if SMTP
-static char sccsid[] = "@(#)usersmtp.c 8.87 (Berkeley) 6/3/97 (with SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 8.88 (Berkeley) 10/20/97 (with SMTP)";
#else
-static char sccsid[] = "@(#)usersmtp.c 8.87 (Berkeley) 6/3/97 (without SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 8.88 (Berkeley) 10/20/97 (without SMTP)";
#endif
#endif /* not lint */
@@ -60,7 +60,6 @@ static char sccsid[] = "@(#)usersmtp.c 8.87 (Berkeley) 6/3/97 (without SMTP)";
char SmtpMsgBuffer[MAXLINE]; /* buffer for commands */
char SmtpReplyBuffer[MAXLINE]; /* buffer for replies */
char SmtpError[MAXLINE] = ""; /* save failure error messages */
-int SmtpPid; /* pid of mailer */
bool SmtpNeedIntro; /* need "while talking" in transcript */
extern void smtpmessage __P((char *f, MAILER *m, MCI *mci, ...));
diff --git a/usr.sbin/sendmail/src/util.c b/usr.sbin/sendmail/src/util.c
index c655b62..c305a31 100644
--- a/usr.sbin/sendmail/src/util.c
+++ b/usr.sbin/sendmail/src/util.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)util.c 8.133 (Berkeley) 8/1/97";
+static char sccsid[] = "@(#)util.c 8.137 (Berkeley) 10/22/97";
#endif /* not lint */
# include "sendmail.h"
@@ -520,6 +520,7 @@ putline(l, mci)
** pxflags -- flag bits:
** PXLF_MAPFROM -- map From_ to >From_.
** PXLF_STRIP8BIT -- strip 8th bit.
+** PXLF_HEADER -- map bare newline in header to newline space.
**
** Returns:
** none
@@ -626,7 +627,8 @@ putxline(l, len, mci, pxflags)
fputs(mci->mci_mailer->m_eol, mci->mci_out);
if (l < end && *l == '\n')
{
- if (*++l != ' ' && *l != '\t' && *l != '\0')
+ if (*++l != ' ' && *l != '\t' && *l != '\0' &&
+ bitset(PXLF_HEADER, pxflags))
{
(void) putc(' ', mci->mci_out);
if (TrafficLogFile != NULL)
@@ -1058,7 +1060,6 @@ checkfd012(where)
{
#if XDEBUG
register int i;
- struct stat stbuf;
for (i = 0; i < 3; i++)
fill_fd(i, where);
@@ -1199,7 +1200,6 @@ dumpfd(fd, printclosed, logit)
int i;
struct stat st;
char buf[200];
- extern char *hostnamebyanyaddr();
p = buf;
snprintf(p, SPACELEFT(buf, p), "%3d: ", fd);
@@ -1311,7 +1311,7 @@ defprint:
printit:
if (logit)
- sm_syslog(LOG_DEBUG, CurEnv->e_id,
+ sm_syslog(LOG_DEBUG, CurEnv ? CurEnv->e_id : NULL,
"%.800s", buf);
else
printf("%s\n", buf);
OpenPOWER on IntegriCloud