summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2003-03-03 17:09:13 +0000
committergshapiro <gshapiro@FreeBSD.org>2003-03-03 17:09:13 +0000
commit8b739caa56202c57ac3a53e04d5b561d17b20b6c (patch)
treec4b8d0d0ebe91f329b287df46f58ccc920e3b626 /contrib/sendmail/src
parent5f679456e6cc5d369320dfb497d26e22f47f34f0 (diff)
downloadFreeBSD-src-8b739caa56202c57ac3a53e04d5b561d17b20b6c.zip
FreeBSD-src-8b739caa56202c57ac3a53e04d5b561d17b20b6c.tar.gz
Import sendmail 8.12.8
Diffstat (limited to 'contrib/sendmail/src')
-rw-r--r--contrib/sendmail/src/README9
-rw-r--r--contrib/sendmail/src/TUNING5
-rw-r--r--contrib/sendmail/src/conf.c4
-rw-r--r--contrib/sendmail/src/daemon.c6
-rw-r--r--contrib/sendmail/src/deliver.c8
-rw-r--r--contrib/sendmail/src/domain.c6
-rw-r--r--contrib/sendmail/src/headers.c282
-rw-r--r--contrib/sendmail/src/main.c8
-rw-r--r--contrib/sendmail/src/mci.c6
-rw-r--r--contrib/sendmail/src/milter.c4
-rw-r--r--contrib/sendmail/src/parseaddr.c6
-rw-r--r--contrib/sendmail/src/queue.c20
-rw-r--r--contrib/sendmail/src/sendmail.h6
-rw-r--r--contrib/sendmail/src/srvrsmtp.c21
-rw-r--r--contrib/sendmail/src/tls.c7
-rw-r--r--contrib/sendmail/src/version.c6
16 files changed, 239 insertions, 165 deletions
diff --git a/contrib/sendmail/src/README b/contrib/sendmail/src/README
index bb0dc157..ba9d126 100644
--- a/contrib/sendmail/src/README
+++ b/contrib/sendmail/src/README
@@ -1,4 +1,4 @@
-# Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+# Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
# All rights reserved.
# Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
# Copyright (c) 1988
@@ -9,7 +9,7 @@
# the sendmail distribution.
#
#
-# $Id: README,v 8.355.2.11 2002/12/18 17:15:46 ca Exp $
+# $Id: README,v 8.355.2.13 2003/01/15 19:17:15 ca Exp $
#
This directory contains the source files for sendmail(TM).
@@ -291,7 +291,8 @@ SM_CONF_GETOPT Define this as 0 if you need a reimplementation of getopt(3).
On some systems, getopt does very odd things if called
to scan the arguments twice. This flag will ask sendmail
to compile in a local version of getopt that works
- properly.
+ properly. You may also need this if you build with
+ another library that introduces a non-standard getopt(3).
NEEDSTRTOL Define this if your standard C library does not define
strtol(3). This will compile in a local version.
NEEDFSYNC Define this if your standard C library does not define
@@ -1793,4 +1794,4 @@ util.c Some general purpose routines used by sendmail.
version.c The version number and information about this
version of sendmail.
-(Version $Revision: 8.355.2.11 $, last update $Date: 2002/12/18 17:15:46 $ )
+(Version $Revision: 8.355.2.13 $, last update $Date: 2003/01/15 19:17:15 $ )
diff --git a/contrib/sendmail/src/TUNING b/contrib/sendmail/src/TUNING
index 52da793..61121cb 100644
--- a/contrib/sendmail/src/TUNING
+++ b/contrib/sendmail/src/TUNING
@@ -1,11 +1,11 @@
-# Copyright (c) 2001-2002 Sendmail, Inc. and its suppliers.
+# Copyright (c) 2001-2003 Sendmail, Inc. and its suppliers.
# All rights reserved.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
-# $Id: TUNING,v 1.18 2002/03/03 03:38:21 ca Exp $
+# $Id: TUNING,v 1.18.4.1 2003/02/07 18:19:51 ca Exp $
#
********************************************
@@ -159,7 +159,6 @@ QUEUE_GROUP(`one', `P=/var/spool/mqueue/one, F=f, r=50, R=3')dnl
QUEUE_GROUP(`two', `P=/var/spool/mqueue/two, F=f, r=30, R=4')dnl
QUEUE_GROUP(`remote', `P=/var/spool/mqueue/remote, F=f, r=5, R=8, I=2m')dnl
define(`ESMTP_MAILER_QGRP', `remote')dnl
-define(`confSPLIT_ACROSS_QUEUEGROUPS', `True')dnl
define(`confDELIVERY_MODE', `q')dnl
define(`confMAX_QUEUE_CHILDREN', `50')dnl
define(`confMIN_QUEUE_AGE', `27m')dnl
diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c
index 69e5c67..29e8a21 100644
--- a/contrib/sendmail/src/conf.c
+++ b/contrib/sendmail/src/conf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: conf.c,v 8.972.2.25 2002/12/12 21:19:29 ca Exp $")
+SM_RCSID("@(#)$Id: conf.c,v 8.972.2.27 2003/01/15 19:17:14 ca Exp $")
#include <sendmail/pathnames.h>
diff --git a/contrib/sendmail/src/daemon.c b/contrib/sendmail/src/daemon.c
index 5f8f146..d12e162 100644
--- a/contrib/sendmail/src/daemon.c
+++ b/contrib/sendmail/src/daemon.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: daemon.c,v 8.613.2.11 2002/12/05 16:13:52 ca Exp $")
+SM_RCSID("@(#)$Id: daemon.c,v 8.613.2.14 2003/02/11 17:17:22 ca Exp $")
#if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__)
# define USE_SOCK_STREAM 1
@@ -3518,7 +3518,7 @@ getauthinfo(fd, may_be_forged)
if (i < 0 || p == &ibuf[0])
goto noident;
- if (*--p == '\n' && *--p == '\r')
+ if (p >= &ibuf[2] && *--p == '\n' && *--p == '\r')
p--;
*++p = '\0';
diff --git a/contrib/sendmail/src/deliver.c b/contrib/sendmail/src/deliver.c
index 46b5ba6..2cb6e3f 100644
--- a/contrib/sendmail/src/deliver.c
+++ b/contrib/sendmail/src/deliver.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <sys/time.h>
-SM_RCSID("@(#)$Id: deliver.c,v 8.940.2.10 2002/12/12 22:46:34 ca Exp $")
+SM_RCSID("@(#)$Id: deliver.c,v 8.940.2.15 2003/02/07 17:57:43 ca Exp $")
#if HASSETUSERCONTEXT
# include <login_cap.h>
@@ -6124,8 +6124,8 @@ ssl_retry:
if (LogLevel > 5)
{
sm_syslog(LOG_ERR, e->e_id,
- "STARTTLS=client, error: connect failed=%d, SSL_error=%d, timedout=%d",
- result, i, (int) timedout);
+ "STARTTLS=client, error: connect failed=%d, SSL_error=%d, timedout=%d, errno=%d",
+ result, i, (int) timedout, errno);
if (LogLevel > 8)
tlslogerr("client");
}
diff --git a/contrib/sendmail/src/domain.c b/contrib/sendmail/src/domain.c
index f086d80..0519907 100644
--- a/contrib/sendmail/src/domain.c
+++ b/contrib/sendmail/src/domain.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1986, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -14,9 +14,9 @@
#include <sendmail.h>
#if NAMED_BIND
-SM_RCSID("@(#)$Id: domain.c,v 8.181.2.1 2002/06/27 16:55:04 ca Exp $ (with name server)")
+SM_RCSID("@(#)$Id: domain.c,v 8.181.2.6 2003/01/15 19:17:15 ca Exp $ (with name server)")
#else /* NAMED_BIND */
-SM_RCSID("@(#)$Id: domain.c,v 8.181.2.1 2002/06/27 16:55:04 ca Exp $ (without name server)")
+SM_RCSID("@(#)$Id: domain.c,v 8.181.2.6 2003/01/15 19:17:15 ca Exp $ (without name server)")
#endif /* NAMED_BIND */
#if NAMED_BIND
diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c
index 5d90344..d9966b1 100644
--- a/contrib/sendmail/src/headers.c
+++ b/contrib/sendmail/src/headers.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,9 +13,9 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: headers.c,v 8.266.4.2 2002/09/23 23:42:02 ca Exp $")
+SM_RCSID("@(#)$Id: headers.c,v 8.266.4.4 2003/01/18 00:41:48 gshapiro Exp $")
-static size_t fix_mime_header __P((char *));
+static size_t fix_mime_header __P((HDR *, ENVELOPE *));
static int priencode __P((char *));
static void put_vanilla_header __P((HDR *, char *, MCI *));
@@ -676,8 +676,8 @@ eatheader(e, full, log)
if (buf[0] != '\0')
{
if (bitset(H_FROM, h->h_flags))
- expand(crackaddr(buf), buf, sizeof buf,
- e);
+ expand(crackaddr(buf, e),
+ buf, sizeof buf, e);
h->h_value = sm_rpool_strdup_x(e->e_rpool, buf);
h->h_flags &= ~H_DEFAULT;
}
@@ -998,7 +998,11 @@ priencode(p)
** it and replaces it with "$g". The parse is totally ad hoc
** and isn't even guaranteed to leave something syntactically
** identical to what it started with. However, it does leave
-** something semantically identical.
+** something semantically identical if possible, else at least
+** syntactically correct.
+**
+** For example, it changes "Real Name <real@example.com> (Comment)"
+** to "Real Name <$g> (Comment)".
**
** This algorithm has been cleaned up to handle a wider range
** of cases -- notably quoted and backslash escaped strings.
@@ -1007,6 +1011,7 @@ priencode(p)
**
** Parameters:
** addr -- the address to be cracked.
+** e -- the current envelope.
**
** Returns:
** a pointer to the new version.
@@ -1019,28 +1024,50 @@ priencode(p)
** be copied if it is to be reused.
*/
+#define SM_HAVE_ROOM ((bp < buflim) && (buflim <= bufend))
+
+/*
+** Append a character to bp if we have room.
+** If not, punt and return $g.
+*/
+
+#define SM_APPEND_CHAR(c) \
+ do \
+ { \
+ if (SM_HAVE_ROOM) \
+ *bp++ = (c); \
+ else \
+ goto returng; \
+ } while (0)
+
+#if MAXNAME < 10
+ERROR MAXNAME must be at least 10
+#endif /* MAXNAME < 10 */
+
char *
-crackaddr(addr)
+crackaddr(addr, e)
register char *addr;
+ ENVELOPE *e;
{
register char *p;
register char c;
- int cmtlev;
- int realcmtlev;
- int anglelev, realanglelev;
- int copylev;
- int bracklev;
- bool qmode;
- bool realqmode;
- bool skipping;
- bool putgmac = false;
- bool quoteit = false;
- bool gotangle = false;
- bool gotcolon = false;
+ int cmtlev; /* comment level in input string */
+ int realcmtlev; /* comment level in output string */
+ int anglelev; /* angle level in input string */
+ int copylev; /* 0 == in address, >0 copying */
+ int bracklev; /* bracket level for IPv6 addr check */
+ bool addangle; /* put closing angle in output */
+ bool qmode; /* quoting in original string? */
+ bool realqmode; /* quoting in output string? */
+ bool putgmac = false; /* already wrote $g */
+ bool quoteit = false; /* need to quote next character */
+ bool gotangle = false; /* found first '<' */
+ bool gotcolon = false; /* found a ':' */
register char *bp;
char *buflim;
char *bufhead;
char *addrhead;
+ char *bufend;
static char buf[MAXNAME + 1];
if (tTd(33, 1))
@@ -1055,25 +1082,22 @@ crackaddr(addr)
** adjusted later if we find them.
*/
+ buflim = bufend = &buf[sizeof(buf) - 1];
bp = bufhead = buf;
- buflim = &buf[sizeof buf - 7];
p = addrhead = addr;
- copylev = anglelev = realanglelev = cmtlev = realcmtlev = 0;
+ copylev = anglelev = cmtlev = realcmtlev = 0;
bracklev = 0;
- qmode = realqmode = false;
+ qmode = realqmode = addangle = false;
while ((c = *p++) != '\0')
{
/*
- ** If the buffer is overful, go into a special "skipping"
- ** mode that tries to keep legal syntax but doesn't actually
- ** output things.
+ ** Try to keep legal syntax using spare buffer space
+ ** (maintained by buflim).
*/
- skipping = bp >= buflim;
-
- if (copylev > 0 && !skipping)
- *bp++ = c;
+ if (copylev > 0)
+ SM_APPEND_CHAR(c);
/* check for backslash escapes */
if (c == '\\')
@@ -1088,8 +1112,8 @@ crackaddr(addr)
p--;
goto putg;
}
- if (copylev > 0 && !skipping)
- *bp++ = c;
+ if (copylev > 0)
+ SM_APPEND_CHAR(c);
goto putg;
}
@@ -1097,8 +1121,14 @@ crackaddr(addr)
if (c == '"' && cmtlev <= 0)
{
qmode = !qmode;
- if (copylev > 0 && !skipping)
+ if (copylev > 0 && SM_HAVE_ROOM)
+ {
+ if (realqmode)
+ buflim--;
+ else
+ buflim++;
realqmode = !realqmode;
+ }
continue;
}
if (qmode)
@@ -1110,15 +1140,15 @@ crackaddr(addr)
cmtlev++;
/* allow space for closing paren */
- if (!skipping)
+ if (SM_HAVE_ROOM)
{
buflim--;
realcmtlev++;
if (copylev++ <= 0)
{
if (bp != bufhead)
- *bp++ = ' ';
- *bp++ = c;
+ SM_APPEND_CHAR(' ');
+ SM_APPEND_CHAR(c);
}
}
}
@@ -1128,7 +1158,7 @@ crackaddr(addr)
{
cmtlev--;
copylev--;
- if (!skipping)
+ if (SM_HAVE_ROOM)
{
realcmtlev--;
buflim++;
@@ -1139,7 +1169,7 @@ crackaddr(addr)
else if (c == ')')
{
/* syntax error: unmatched ) */
- if (copylev > 0 && !skipping)
+ if (copylev > 0 && SM_HAVE_ROOM)
bp--;
}
@@ -1157,7 +1187,7 @@ crackaddr(addr)
/*
** Check for DECnet phase IV ``::'' (host::user)
- ** or ** DECnet phase V ``:.'' syntaxes. The latter
+ ** or DECnet phase V ``:.'' syntaxes. The latter
** covers ``user@DEC:.tay.myhost'' and
** ``DEC:.tay.myhost::user'' syntaxes (bletch).
*/
@@ -1166,10 +1196,10 @@ crackaddr(addr)
{
if (cmtlev <= 0 && !qmode)
quoteit = true;
- if (copylev > 0 && !skipping)
+ if (copylev > 0)
{
- *bp++ = c;
- *bp++ = *p;
+ SM_APPEND_CHAR(c);
+ SM_APPEND_CHAR(*p);
}
p++;
goto putg;
@@ -1180,41 +1210,43 @@ crackaddr(addr)
bp = bufhead;
if (quoteit)
{
- *bp++ = '"';
+ SM_APPEND_CHAR('"');
/* back up over the ':' and any spaces */
--p;
- while (isascii(*--p) && isspace(*p))
+ while (p > addr &&
+ isascii(*--p) && isspace(*p))
continue;
p++;
}
for (q = addrhead; q < p; )
{
c = *q++;
- if (bp < buflim)
+ if (quoteit && c == '"')
{
- if (quoteit && c == '"')
- *bp++ = '\\';
- *bp++ = c;
+ SM_APPEND_CHAR('\\');
+ SM_APPEND_CHAR(c);
}
+ else
+ SM_APPEND_CHAR(c);
}
if (quoteit)
{
if (bp == &bufhead[1])
bp--;
else
- *bp++ = '"';
+ SM_APPEND_CHAR('"');
while ((c = *p++) != ':')
- {
- if (bp < buflim)
- *bp++ = c;
- }
- *bp++ = c;
+ SM_APPEND_CHAR(c);
+ SM_APPEND_CHAR(c);
}
/* any trailing white space is part of group: */
- while (isascii(*p) && isspace(*p) && bp < buflim)
- *bp++ = *p++;
+ while (isascii(*p) && isspace(*p))
+ {
+ SM_APPEND_CHAR(*p);
+ p++;
+ }
copylev = 0;
putgmac = quoteit = false;
bufhead = bp;
@@ -1223,10 +1255,7 @@ crackaddr(addr)
}
if (c == ';' && copylev <= 0 && !ColonOkInAddr)
- {
- if (bp < buflim)
- *bp++ = c;
- }
+ SM_APPEND_CHAR(c);
/* check for characters that may have to be quoted */
if (strchr(MustQuoteChars, c) != NULL)
@@ -1254,42 +1283,45 @@ crackaddr(addr)
/* oops -- have to change our mind */
anglelev = 1;
- if (!skipping)
- realanglelev = 1;
+ if (SM_HAVE_ROOM)
+ {
+ if (!addangle)
+ buflim--;
+ addangle = true;
+ }
bp = bufhead;
if (quoteit)
{
- *bp++ = '"';
+ SM_APPEND_CHAR('"');
/* back up over the '<' and any spaces */
--p;
- while (isascii(*--p) && isspace(*p))
+ while (p > addr &&
+ isascii(*--p) && isspace(*p))
continue;
p++;
}
for (q = addrhead; q < p; )
{
c = *q++;
- if (bp < buflim)
+ if (quoteit && c == '"')
{
- if (quoteit && c == '"')
- *bp++ = '\\';
- *bp++ = c;
+ SM_APPEND_CHAR('\\');
+ SM_APPEND_CHAR(c);
}
+ else
+ SM_APPEND_CHAR(c);
}
if (quoteit)
{
if (bp == &buf[1])
bp--;
else
- *bp++ = '"';
+ SM_APPEND_CHAR('"');
while ((c = *p++) != '<')
- {
- if (bp < buflim)
- *bp++ = c;
- }
- *bp++ = c;
+ SM_APPEND_CHAR(c);
+ SM_APPEND_CHAR(c);
}
copylev = 0;
putgmac = quoteit = false;
@@ -1301,13 +1333,14 @@ crackaddr(addr)
if (anglelev > 0)
{
anglelev--;
- if (!skipping)
+ if (SM_HAVE_ROOM)
{
- realanglelev--;
- buflim++;
+ if (addangle)
+ buflim++;
+ addangle = false;
}
}
- else if (!skipping)
+ else if (SM_HAVE_ROOM)
{
/* syntax error: unmatched > */
if (copylev > 0)
@@ -1316,7 +1349,7 @@ crackaddr(addr)
continue;
}
if (copylev++ <= 0)
- *bp++ = c;
+ SM_APPEND_CHAR(c);
continue;
}
@@ -1324,30 +1357,42 @@ crackaddr(addr)
putg:
if (copylev <= 0 && !putgmac)
{
- if (bp > bufhead && bp[-1] == ')')
- *bp++ = ' ';
- *bp++ = MACROEXPAND;
- *bp++ = 'g';
+ if (bp > buf && bp[-1] == ')')
+ SM_APPEND_CHAR(' ');
+ SM_APPEND_CHAR(MACROEXPAND);
+ SM_APPEND_CHAR('g');
putgmac = true;
}
}
/* repair any syntactic damage */
- if (realqmode)
+ if (realqmode && bp < bufend)
*bp++ = '"';
- while (realcmtlev-- > 0)
+ while (realcmtlev-- > 0 && bp < bufend)
*bp++ = ')';
- while (realanglelev-- > 0)
+ if (addangle && bp < bufend)
*bp++ = '>';
- *bp++ = '\0';
-
+ *bp = '\0';
+ if (bp < bufend)
+ goto success;
+
+ returng:
+ /* String too long, punt */
+ buf[0] = '<';
+ buf[1] = MACROEXPAND;
+ buf[2]= 'g';
+ buf[3] = '>';
+ buf[4]= '\0';
+ sm_syslog(LOG_ALERT, e->e_id,
+ "Dropped invalid comments from header address");
+
+ success:
if (tTd(33, 1))
{
sm_dprintf("crackaddr=>`");
xputs(buf);
sm_dprintf("'\n");
}
-
return buf;
}
/*
@@ -1412,7 +1457,7 @@ putheader(mci, hdr, e, flags)
{
size_t len;
- len = fix_mime_header(h->h_value);
+ len = fix_mime_header(h, e);
if (len > 0)
{
sm_syslog(LOG_ALERT, e->e_id,
@@ -1455,13 +1500,28 @@ putheader(mci, hdr, e, flags)
if (shorten_rfc822_string(h->h_value,
MaxMimeHeaderLength))
{
- sm_syslog(LOG_ALERT, e->e_id,
- "Truncated long MIME %s header (length = %ld) (possible attack)",
- h->h_field, (unsigned long) len);
- if (tTd(34, 11))
- sm_dprintf(" truncated long MIME %s header (length = %ld) (possible attack)\n",
- h->h_field,
- (unsigned long) len);
+ if (len < MaxMimeHeaderLength)
+ {
+ /* we only rebalanced a bogus header */
+ sm_syslog(LOG_ALERT, e->e_id,
+ "Fixed MIME %s header (possible attack)",
+ h->h_field);
+ if (tTd(34, 11))
+ sm_dprintf(" fixed MIME %s header (possible attack)\n",
+ h->h_field);
+ }
+ else
+ {
+ /* we actually shortened header */
+ sm_syslog(LOG_ALERT, e->e_id,
+ "Truncated long MIME %s header (length = %ld) (possible attack)",
+ h->h_field,
+ (unsigned long) len);
+ if (tTd(34, 11))
+ sm_dprintf(" truncated long MIME %s header (length = %ld) (possible attack)\n",
+ h->h_field,
+ (unsigned long) len);
+ }
}
}
@@ -1856,7 +1916,8 @@ copyheader(header, rpool)
** to MaxMimeFieldLength.
**
** Parameters:
-** string -- the full header
+** h -- the header to truncate/rebalance
+** e -- the current envelope
**
** Returns:
** length of last offending field, 0 if all ok.
@@ -1866,15 +1927,16 @@ copyheader(header, rpool)
*/
static size_t
-fix_mime_header(string)
- char *string;
+fix_mime_header(h, e)
+ HDR *h;
+ ENVELOPE *e;
{
- char *begin = string;
+ char *begin = h->h_value;
char *end;
size_t len = 0;
size_t retlen = 0;
- if (string == NULL || *string == '\0')
+ if (begin == NULL || *begin == '\0')
return 0;
/* Split on each ';' */
@@ -1889,7 +1951,23 @@ fix_mime_header(string)
/* Shorten individual parameter */
if (shorten_rfc822_string(begin, MaxMimeFieldLength))
- retlen = len;
+ {
+ if (len < MaxMimeFieldLength)
+ {
+ /* we only rebalanced a bogus field */
+ sm_syslog(LOG_ALERT, e->e_id,
+ "Fixed MIME %s header field (possible attack)",
+ h->h_field);
+ if (tTd(34, 11))
+ sm_dprintf(" fixed MIME %s header field (possible attack)\n",
+ h->h_field);
+ }
+ else
+ {
+ /* we actually shortened the header */
+ retlen = len;
+ }
+ }
/* Collapse the possibly shortened string with rest */
bp = begin + strlen(begin);
diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c
index fd981fc9..e79d923 100644
--- a/contrib/sendmail/src/main.c
+++ b/contrib/sendmail/src/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -25,7 +25,7 @@ SM_UNUSED(static char copyright[]) =
The Regents of the University of California. All rights reserved.\n";
#endif /* ! lint */
-SM_RCSID("@(#)$Id: main.c,v 8.887.2.12 2002/12/05 17:38:44 ca Exp $")
+SM_RCSID("@(#)$Id: main.c,v 8.887.2.20 2003/02/07 17:57:44 ca Exp $")
#if NETINET || NETINET6
@@ -77,7 +77,7 @@ static SIGFUNC_DECL sigusr1 __P((int));
** UCB/Mammoth Project (10/89 - 7/95).
** InReference, Inc. (8/95 - 1/97).
** Sendmail, Inc. (1/98 - present).
-** The support of the my employers is gratefully acknowledged.
+** The support of my employers is gratefully acknowledged.
** Few of them (Britton-Lee in particular) have had
** anything to gain from my involvement in this project.
**
@@ -4241,7 +4241,7 @@ testmodeline(line, e)
"Usage: /parse address\n");
return;
}
- q = crackaddr(p);
+ q = crackaddr(p, e);
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
"Cracked address = ");
xputs(q);
diff --git a/contrib/sendmail/src/mci.c b/contrib/sendmail/src/mci.c
index 5172333..033387b 100644
--- a/contrib/sendmail/src/mci.c
+++ b/contrib/sendmail/src/mci.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: mci.c,v 8.205.2.2 2002/11/26 19:15:19 gshapiro Exp $")
+SM_RCSID("@(#)$Id: mci.c,v 8.205.2.3 2003/01/07 03:56:19 ca Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -1244,10 +1244,8 @@ mci_print_persistent(pathname, hostname)
locked ? '*' : ' ', hostname,
pintvl(curtime() - mcib.mci_lastuse, true));
if (mcib.mci_rstatus != NULL)
- {
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "%.*s\n", width,
mcib.mci_rstatus);
- }
else if (mcib.mci_exitstat == EX_TEMPFAIL && mcib.mci_errno != 0)
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
"Deferred: %.*s\n", width - 10,
diff --git a/contrib/sendmail/src/milter.c b/contrib/sendmail/src/milter.c
index 585981c..305c304 100644
--- a/contrib/sendmail/src/milter.c
+++ b/contrib/sendmail/src/milter.c
@@ -10,7 +10,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: milter.c,v 8.197.2.5 2002/11/11 23:22:28 ca Exp $")
+SM_RCSID("@(#)$Id: milter.c,v 8.197.2.6 2002/12/30 05:54:00 ca Exp $")
#if MILTER
# include <libmilter/mfapi.h>
@@ -549,7 +549,7 @@ milter_write(m, cmd, buf, len, to, e)
** e -- current envelope.
**
** Returns:
-** connected socket if sucessful && !parseonly,
+** connected socket if successful && !parseonly,
** 0 upon parse success if parseonly,
** -1 otherwise.
*/
diff --git a/contrib/sendmail/src/parseaddr.c b/contrib/sendmail/src/parseaddr.c
index a69554a..296d01c 100644
--- a/contrib/sendmail/src/parseaddr.c
+++ b/contrib/sendmail/src/parseaddr.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: parseaddr.c,v 8.359.2.3 2002/09/26 23:03:39 gshapiro Exp $")
+SM_RCSID("@(#)$Id: parseaddr.c,v 8.359.2.4 2003/01/18 00:41:48 gshapiro Exp $")
static void allocaddr __P((ADDRESS *, int, char *, ENVELOPE *));
static int callsubr __P((char**, int, ENVELOPE *));
@@ -2509,7 +2509,7 @@ remotename(name, m, flags, pstat, e)
if (bitset(RF_CANONICAL, flags) || bitnset(M_NOCOMMENT, m->m_flags))
fancy = "\201g";
else
- fancy = crackaddr(name);
+ fancy = crackaddr(name, e);
/*
** Turn the name into canonical form.
diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c
index a0ce797..0d618ed 100644
--- a/contrib/sendmail/src/queue.c
+++ b/contrib/sendmail/src/queue.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,14 +13,10 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: queue.c,v 8.863.2.22 2002/12/19 18:00:39 ca Exp $")
+SM_RCSID("@(#)$Id: queue.c,v 8.863.2.28 2003/02/11 17:17:22 ca Exp $")
#include <dirent.h>
-#if SM_CONF_SHM
-# include <sm/shm.h>
-#endif /* SM_CONF_SHM */
-
# define RELEASE_QUEUE (void) 0
# define ST_INODE(st) (st).st_ino
@@ -77,7 +73,7 @@ static int NumWorkGroups; /* number of work groups */
** Notice: DoQueueRun is modified in a signal handler!
*/
-static bool volatile DoQueueRun; /* non-interrupt time queue run needed */
+static bool volatile DoQueueRun; /* non-interrupt time queue run needed */
/*
** Work group definition structure.
@@ -1691,7 +1687,7 @@ runner_work(e, sequenceno, didfork, skip, njobs)
w->w_name + 2);
(void) dowork(w->w_qgrp, w->w_qdir, w->w_name + 2,
- ForkQueueRuns , false, e);
+ ForkQueueRuns, false, e);
errno = 0;
}
sm_free(w->w_name); /* XXX */
@@ -3446,7 +3442,6 @@ dowork(qgrp, qdir, id, forkflag, requeueflag, e)
** handler for child process.
*/
-
/* Reset global flags */
RestartRequest = NULL;
RestartWorkGroup = false;
@@ -3633,7 +3628,6 @@ doworklist(el, forkflag, requeueflag)
** handler for child process.
*/
-
/* Reset global flags */
RestartRequest = NULL;
RestartWorkGroup = false;
@@ -6722,10 +6716,12 @@ setup_queues(owner)
hashval = 0;
errno = 0;
len = sm_strlcpy(basedir, QueueDir, sizeof basedir);
- if (len >= sizeof basedir)
+
+ /* Provide space for trailing '/' */
+ if (len >= sizeof basedir - 1)
{
syserr("QueueDirectory: path too long: %d, max %d",
- len, (int) sizeof basedir);
+ len, (int) sizeof basedir - 1);
ExitStat = EX_CONFIG;
return;
}
diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h
index 61b0d13..2bfad15 100644
--- a/contrib/sendmail/src/sendmail.h
+++ b/contrib/sendmail/src/sendmail.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -48,7 +48,7 @@
#ifdef _DEFINE
# ifndef lint
-SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.919.2.15 2002/12/12 22:46:35 ca Exp $";
+SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.919.2.16 2003/01/18 00:41:50 gshapiro Exp $";
# endif /* ! lint */
#endif /* _DEFINE */
@@ -325,7 +325,7 @@ extern ADDRESS NullAddress; /* a null (template) address [main.c] */
/* functions */
extern void cataddr __P((char **, char **, char *, int, int));
-extern char *crackaddr __P((char *));
+extern char *crackaddr __P((char *, ENVELOPE *));
extern bool emptyaddr __P((ADDRESS *));
extern ADDRESS *getctladdr __P((ADDRESS *));
extern int include __P((char *, bool, ADDRESS *, ADDRESS **, int, ENVELOPE *));
diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c
index 12ad2e7..2be4d65 100644
--- a/contrib/sendmail/src/srvrsmtp.c
+++ b/contrib/sendmail/src/srvrsmtp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -16,7 +16,7 @@
# include <libmilter/mfdef.h>
#endif /* MILTER */
-SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.829.2.17 2002/12/09 16:46:18 ca Exp $")
+SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.829.2.21 2003/01/15 19:17:14 ca Exp $")
#if SASL || STARTTLS
# include <sys/time.h>
@@ -1635,8 +1635,8 @@ smtp(nullserver, d_flags, e)
if (LogLevel > 5)
{
sm_syslog(LOG_WARNING, NOQID,
- "STARTTLS=server, error: accept failed=%d, SSL_error=%d, timedout=%d",
- r, i, (int) timedout);
+ "STARTTLS=server, error: accept failed=%d, SSL_error=%d, timedout=%d, errno=%d",
+ r, i, (int) timedout, errno);
if (LogLevel > 8)
tlslogerr("server");
}
@@ -2717,17 +2717,22 @@ tlsfail:
id = p;
if (*id == '#')
{
- int wgrp;
+ int i, qgrp;
id++;
- wgrp = name2qid(id);
- if (!ISVALIDQGRP(wgrp))
+ qgrp = name2qid(id);
+ if (!ISVALIDQGRP(qgrp))
{
usrerr("459 4.5.4 Queue %s unknown",
id);
break;
}
- ok = run_work_group(wgrp, RWG_FORK|RWG_RUNALL);
+ for (i = 0; i < NumQueue && Queue[i] != NULL;
+ i++)
+ Queue[i]->qg_nextrun = (time_t) -1;
+ Queue[qgrp]->qg_nextrun = 0;
+ ok = run_work_group(Queue[qgrp]->qg_wgrp,
+ RWG_FORK|RWG_FORCE);
if (ok && Errors == 0)
message("250 2.0.0 Queuing for queue group %s started", id);
break;
diff --git a/contrib/sendmail/src/tls.c b/contrib/sendmail/src/tls.c
index 8a7fa9f..10a6fe2 100644
--- a/contrib/sendmail/src/tls.c
+++ b/contrib/sendmail/src/tls.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2000-2003 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -10,7 +10,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: tls.c,v 8.79.4.1 2002/09/03 17:31:45 gshapiro Exp $")
+SM_RCSID("@(#)$Id: tls.c,v 8.79.4.2 2003/01/23 23:16:24 ca Exp $")
#if STARTTLS
# include <openssl/err.h>
@@ -19,9 +19,6 @@ SM_RCSID("@(#)$Id: tls.c,v 8.79.4.1 2002/09/03 17:31:45 gshapiro Exp $")
# ifndef HASURANDOMDEV
# include <openssl/rand.h>
# endif /* ! HASURANDOMDEV */
-# if SM_CONF_SHM
-# include <sm/shm.h>
-# endif /* SM_CONF_SHM */
# if !TLS_NO_RSA
static RSA *rsa_tmp = NULL; /* temporary RSA key */
static RSA *tmp_rsa_key __P((SSL *, int, int));
diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c
index 2be1ca9..d8a2983 100644
--- a/contrib/sendmail/src/version.c
+++ b/contrib/sendmail/src/version.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,6 +13,6 @@
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: version.c,v 8.104.2.11 2002/12/28 19:45:53 ca Exp $")
+SM_RCSID("@(#)$Id: version.c,v 8.104.2.14 2003/01/15 17:55:43 ca Exp $")
-char Version[] = "8.12.7";
+char Version[] = "8.12.8";
OpenPOWER on IntegriCloud