summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2003-09-19 23:14:57 +0000
committergshapiro <gshapiro@FreeBSD.org>2003-09-19 23:14:57 +0000
commitff300598d7a6eb62ff5943e34793264a25bbaccf (patch)
tree10254441c41119a570c883ad07917b96add798c0 /contrib/sendmail/src
parentaef2ea8df10edaa6310033ae78c9fba183ddd1c1 (diff)
downloadFreeBSD-src-ff300598d7a6eb62ff5943e34793264a25bbaccf.zip
FreeBSD-src-ff300598d7a6eb62ff5943e34793264a25bbaccf.tar.gz
Fix sendmail 8.12.10 import conflicts
Diffstat (limited to 'contrib/sendmail/src')
-rw-r--r--contrib/sendmail/src/conf.c81
-rw-r--r--contrib/sendmail/src/headers.c52
-rw-r--r--contrib/sendmail/src/mci.c21
-rw-r--r--contrib/sendmail/src/sendmail.810
4 files changed, 117 insertions, 47 deletions
diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c
index be083b4..5b3ca3e 100644
--- a/contrib/sendmail/src/conf.c
+++ b/contrib/sendmail/src/conf.c
@@ -9,13 +9,17 @@
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
+ * $FreeBSD$
*/
#include <sendmail.h>
-SM_RCSID("@(#)$Id: conf.c,v 8.972.2.35 2003/03/28 05:46:09 ca Exp $")
+SM_RCSID("@(#)$Id: conf.c,v 8.972.2.50 2003/09/03 21:37:03 ca Exp $")
#include <sendmail/pathnames.h>
+#if NEWDB
+# include "sm/bdb.h"
+#endif /* NEWDB */
# include <sys/ioctl.h>
# include <sys/param.h>
@@ -465,6 +469,19 @@ setupmaps()
register STAB *s;
#if NEWDB
+# if DB_VERSION_MAJOR > 1
+ int major_v, minor_v, patch_v;
+
+ (void) db_version(&major_v, &minor_v, &patch_v);
+ if (major_v != DB_VERSION_MAJOR || minor_v != DB_VERSION_MINOR)
+ {
+ errno = 0;
+ syserr("Berkeley DB version mismatch: compiled against %d.%d.%d, run-time linked against %d.%d.%d",
+ DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
+ major_v, minor_v, patch_v);
+ }
+# endif /* DB_VERSION_MAJOR > 1 */
+
MAPDEF("hash", ".db", MCF_ALIASOK|MCF_REBUILDABLE,
map_parseargs, hash_map_open, db_map_close,
db_map_lookup, db_map_store);
@@ -2227,7 +2244,7 @@ refuseconnections(name, e, d, active)
sm_setproctitle(true, e, R_MSG_LA, name, CurrentLA);
if (LogLevel > 8)
sm_syslog(LOG_NOTICE, NOQID, R_MSG_LA, name, CurrentLA);
-#if _FFR_REJECT_LOG
+# if _FFR_REJECT_LOG
now = curtime();
if (firstrejtime[d] == 0)
{
@@ -2240,13 +2257,13 @@ refuseconnections(name, e, d, active)
pintvl(now - firstrejtime[d], true));
nextlogtime[d] = now + RejectLogInterval;
}
-#endif /* _FFR_REJECT_LOG */
+# endif /* _FFR_REJECT_LOG */
return true;
}
-#if _FFR_REJECT_LOG
+# if _FFR_REJECT_LOG
else
firstrejtime[d] = 0;
-#endif /* _FFR_REJECT_LOG */
+# endif /* _FFR_REJECT_LOG */
if (DelayLA > 0 && CurrentLA >= DelayLA)
{
@@ -2428,12 +2445,12 @@ initsetproctitle(argc, argv, envp)
*/
align = -1;
-#if _FFR_SPT_ALIGN
-# ifdef SPT_ALIGN_SIZE
+# if _FFR_SPT_ALIGN
+# ifdef SPT_ALIGN_SIZE
for (i = SPT_ALIGN_SIZE; i > 0; i >>= 1)
align++;
-# endif /* SPT_ALIGN_SIZE */
-#endif /* _FFR_SPT_ALIGN */
+# endif /* SPT_ALIGN_SIZE */
+# endif /* _FFR_SPT_ALIGN */
for (i = 0; i < argc; i++)
{
@@ -2818,25 +2835,6 @@ uname(name)
return 0;
}
-# if 0
- /*
- ** Popen is known to have security holes.
- */
-
- /* try uuname -l to return local name */
- if ((file = popen("uuname -l", "r")) != NULL)
- {
- (void) sm_io_fgets(file, SM_TIME_DEFAULT, name,
- NODE_LENGTH + 1);
- (void) pclose(file);
- n = strchr(name, '\n');
- if (n != NULL)
- *n = '\0';
- if (name->nodename[0] != '\0')
- return 0;
- }
-# endif /* 0 */
-
return -1;
}
#endif /* !HASUNAME */
@@ -4733,7 +4731,7 @@ load_if_names()
# ifndef __hpux
lifc.lifc_family = AF_UNSPEC;
lifc.lifc_flags = 0;
-# endif /* __hpux */
+# endif /* ! __hpux */
if (ioctl(s, SIOCGLIFCONF, (char *)&lifc) < 0)
{
if (tTd(0, 4))
@@ -5678,6 +5676,9 @@ char *OsCompileOptions[] =
#if ADDRCONFIG_IS_BROKEN
"ADDRCONFIG_IS_BROKEN",
#endif /* ADDRCONFIG_IS_BROKEN */
+#if ALLOW_255
+ "ALLOW_255",
+#endif /* ALLOW_255 */
#ifdef AUTO_NETINFO_HOSTS
"AUTO_NETINFO_HOSTS",
#endif /* AUTO_NETINFO_HOSTS */
@@ -5929,6 +5930,10 @@ char *FFRCompileOptions[] =
/* Stricter checks about queue directory permissions. */
"_FFR_CHK_QUEUE",
#endif /* _FFR_CHK_QUEUE */
+#if _FFR_CLIENT_SIZE
+ /* Don't try to send mail if its size exceeds SIZE= of server. */
+ "_FFR_CLIENT_SIZE",
+#endif /* _FFR_CLIENT_SIZE */
#if _FFR_CONTROL_MSTAT
/* Extended daemon status. */
"_FFR_CONTROL_MSTAT",
@@ -5989,6 +5994,10 @@ char *FFRCompileOptions[] =
"_FFR_DROP_TRUSTUSER_WARNING",
#endif /* _FFR_DROP_TRUSTUSER_WARNING */
+#if _FFR_EXTRA_MAP_CHECK
+ /* perform extra checks on $( $) in R lines */
+ "_FFR_EXTRA_MAP_CHECK",
+#endif /* _FFR_EXTRA_MAP_CHECK */
#if _FFR_FIX_DASHT
/*
** If using -t, force not sending to argv recipients, even
@@ -6026,6 +6035,10 @@ char *FFRCompileOptions[] =
/* Use nsswitch on HP-UX */
"_FFR_HPUX_NSSWITCH",
#endif /* _FFR_HPUX_NSSWITCH */
+#if _FFR_IGNORE_BOGUS_ADDR
+ /* Ignore addresses for which prescan() failed */
+ "_FFR_IGNORE_BOGUS_ADDR",
+#endif /* _FFR_IGNORE_BOGUS_ADDR */
#if _FFR_IGNORE_EXT_ON_HELO
/* Ignore extensions offered in response to HELO */
"_FFR_IGNORE_EXT_ON_HELO",
@@ -6049,12 +6062,16 @@ char *FFRCompileOptions[] =
/* Randall S. Winchester of the University of Maryland */
"_FFR_MAX_FORWARD_ENTRIES",
#endif /* _FFR_MAX_FORWARD_ENTRIES */
+#if _FFR_MAX_SLEEP_TIME
+ /* Limit sleep(2) time in libsm/clock.c */
+ "_FFR_MAX_SLEEP_TIME",
+#endif /* _FFR_MAX_SLEEP_TIME */
#if MILTER
# if _FFR_MILTER_421
/* If a filter returns 421, close the SMTP connection */
"_FFR_MILTER_421",
# endif /* _FFR_MILTER_421 */
-# if _FFR_MILTER_PERDAEMON
+# if _FFR_MILTER_PERDAEMON
/* Per DaemonPortOptions InputMailFilter lists */
"_FFR_MILTER_PERDAEMON",
# endif /* _FFR_MILTER_PERDAEMON */
@@ -6144,6 +6161,10 @@ char *FFRCompileOptions[] =
/* Donated code (unused). */
"_FFR_SHM_STATUS",
#endif /* _FFR_SHM_STATUS */
+#if _FFR_SLEEP_USE_SELECT
+ /* Use select(2) in libsm/clock.c to emulate sleep(2) */
+ "_FFR_SLEEP_USE_SELECT ",
+#endif /* _FFR_SLEEP_USE_SELECT */
#if _FFR_SMFI_OPENSOCKET
/* libmilter: smfi_opensocket() to force the socket open early */
"_FFR_SMFI_OPENSOCKET",
diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c
index 890c280..c85ea2d 100644
--- a/contrib/sendmail/src/headers.c
+++ b/contrib/sendmail/src/headers.c
@@ -9,11 +9,12 @@
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
+ * $FreeBSD$
*/
#include <sendmail.h>
-SM_RCSID("@(#)$Id: headers.c,v 8.266.4.5 2003/03/12 22:42:52 gshapiro Exp $")
+SM_RCSID("@(#)$Id: headers.c,v 8.266.4.7 2003/09/03 21:32:20 ca Exp $")
static size_t fix_mime_header __P((HDR *, ENVELOPE *));
static int priencode __P((char *));
@@ -140,7 +141,10 @@ chompheader(line, pflag, hdrp, e)
mid = (unsigned char) macid(p);
if (bitset(0200, mid))
+ {
p += strlen(macname(mid)) + 2;
+ SM_ASSERT(p <= q);
+ }
else
p++;
@@ -315,6 +319,7 @@ hse:
qval[l++] = '"';
/* - 3 to avoid problems with " at the end */
+ /* should be sizeof(qval), not MAXNAME */
for (k = 0; fvalue[k] != '\0' && l < MAXNAME - 3; k++)
{
switch (fvalue[k])
@@ -1175,7 +1180,7 @@ crackaddr(addr, e)
else if (c == ')')
{
/* syntax error: unmatched ) */
- if (copylev > 0 && SM_HAVE_ROOM)
+ if (copylev > 0 && SM_HAVE_ROOM && bp > bufhead)
bp--;
}
@@ -1349,7 +1354,7 @@ crackaddr(addr, e)
else if (SM_HAVE_ROOM)
{
/* syntax error: unmatched > */
- if (copylev > 0)
+ if (copylev > 0 && bp > bufhead)
bp--;
quoteit = true;
continue;
@@ -1693,6 +1698,12 @@ put_vanilla_header(h, v, mci)
int l;
l = nlp - v;
+
+ /*
+ ** XXX This is broken for SPACELEFT()==0
+ ** However, SPACELEFT() is always > 0 unless MAXLINE==1.
+ */
+
if (SPACELEFT(obuf, obp) - 1 < (size_t) l)
l = SPACELEFT(obuf, obp) - 1;
@@ -1703,6 +1714,8 @@ put_vanilla_header(h, v, mci)
if (*v != ' ' && *v != '\t')
*obp++ = ' ';
}
+
+ /* XXX This is broken for SPACELEFT()==0 */
(void) sm_snprintf(obp, SPACELEFT(obuf, obp), "%.*s",
(int) (SPACELEFT(obuf, obp) - 1), v);
putxline(obuf, strlen(obuf), mci, putflags);
@@ -1737,6 +1750,7 @@ commaize(h, p, oldstyle, mci, e)
int omax;
bool firstone = true;
int putflags = PXLF_HEADER;
+ char **res;
char obuf[MAXLINE + 3];
/*
@@ -1753,6 +1767,8 @@ commaize(h, p, oldstyle, mci, e)
obp = obuf;
(void) sm_snprintf(obp, SPACELEFT(obuf, obp), "%.200s: ",
h->h_field);
+
+ /* opos = strlen(obp); */
opos = strlen(h->h_field) + 2;
if (opos > 202)
opos = 202;
@@ -1785,14 +1801,23 @@ commaize(h, p, oldstyle, mci, e)
while ((isascii(*p) && isspace(*p)) || *p == ',')
p++;
name = p;
+ res = NULL;
for (;;)
{
auto char *oldp;
char pvpbuf[PSBUFSIZE];
- (void) prescan(p, oldstyle ? ' ' : ',', pvpbuf,
- sizeof pvpbuf, &oldp, NULL);
+ res = prescan(p, oldstyle ? ' ' : ',', pvpbuf,
+ sizeof pvpbuf, &oldp, NULL);
p = oldp;
+#if _FFR_IGNORE_BOGUS_ADDR
+ /* ignore addresses that can't be parsed */
+ if (res == NULL)
+ {
+ name = p;
+ continue;
+ }
+#endif /* _FFR_IGNORE_BOGUS_ADDR */
/* look to see if we have an at sign */
while (*p != '\0' && isascii(*p) && isspace(*p))
@@ -1815,6 +1840,15 @@ commaize(h, p, oldstyle, mci, e)
p--;
if (++p == name)
continue;
+
+ /*
+ ** if prescan() failed go a bit backwards; this is a hack,
+ ** there should be some better error recovery.
+ */
+
+ if (res == NULL && p > name &&
+ !((isascii(*p) && isspace(*p)) || *p == ',' || *p == '\0'))
+ --p;
savechar = *p;
*p = '\0';
@@ -1858,7 +1892,7 @@ commaize(h, p, oldstyle, mci, e)
(void) sm_strlcpy(obp, ",\n", SPACELEFT(obuf, obp));
putxline(obuf, strlen(obuf), mci, putflags);
obp = obuf;
- (void) sm_strlcpy(obp, " ", sizeof obp);
+ (void) sm_strlcpy(obp, " ", sizeof obuf);
opos = strlen(obp);
obp += opos;
opos += strlen(name);
@@ -1874,7 +1908,10 @@ commaize(h, p, oldstyle, mci, e)
firstone = false;
*p = savechar;
}
- *obp = '\0';
+ if (obp < &obuf[sizeof obuf])
+ *obp = '\0';
+ else
+ obuf[sizeof obuf - 1] = '\0';
putxline(obuf, strlen(obuf), mci, putflags);
}
/*
@@ -1946,6 +1983,7 @@ fix_mime_header(h, e)
return 0;
/* Split on each ';' */
+ /* find_character() never returns NULL */
while ((end = find_character(begin, ';')) != NULL)
{
char save = *end;
diff --git a/contrib/sendmail/src/mci.c b/contrib/sendmail/src/mci.c
index 033387b..a6b558e 100644
--- a/contrib/sendmail/src/mci.c
+++ b/contrib/sendmail/src/mci.c
@@ -9,11 +9,12 @@
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
+ * $FreeBSD$
*/
#include <sendmail.h>
-SM_RCSID("@(#)$Id: mci.c,v 8.205.2.3 2003/01/07 03:56:19 ca Exp $")
+SM_RCSID("@(#)$Id: mci.c,v 8.205.2.4 2003/03/31 17:35:27 ca Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -548,11 +549,21 @@ mci_dump(mci, logit)
}
(void) sm_snprintf(p, SPACELEFT(buf, p), "flags=%lx", mci->mci_flags);
p += strlen(p);
+
+ /*
+ ** The following check is just for paranoia. It protects the
+ ** assignment in the if() clause. If there's not some minimum
+ ** amount of space we can stop right now. The check will not
+ ** trigger as long as sizeof(buf)=4000.
+ */
+
+ if (p >= buf + sizeof(buf) - 4)
+ goto printit;
if (mci->mci_flags != 0)
{
struct mcifbits *f;
- *p++ = '<';
+ *p++ = '<'; /* protected above */
for (f = MciFlags; f->mcif_bit != 0; f++)
{
if (!bitset(f->mcif_bit, mci->mci_flags))
@@ -1152,7 +1163,7 @@ mci_traverse_persistent(action, pathname)
if (hostptr != host)
*(hostptr++) = '.';
start = end;
- while (*(start - 1) != '/')
+ while (start > pathname && *(start - 1) != '/')
start--;
if (*end == '.')
@@ -1162,7 +1173,7 @@ mci_traverse_persistent(action, pathname)
*(hostptr++) = *scan;
end = start - 2;
- } while (*end == '.');
+ } while (end > pathname && *end == '.');
*hostptr = '\0';
@@ -1352,7 +1363,7 @@ mci_purge_persistent(pathname, hostname)
/*
** MCI_GENERATE_PERSISTENT_PATH -- generate path from hostname
**
-** Given `host', convert from a.b.c to $QueueDir/.hoststat/c./b./a,
+** Given `host', convert from a.b.c to $HostStatDir/c./b./a,
** putting the result into `path'. if `createflag' is set, intervening
** directories will be created as needed.
**
diff --git a/contrib/sendmail/src/sendmail.8 b/contrib/sendmail/src/sendmail.8
index 1c014fd..52a58be 100644
--- a/contrib/sendmail/src/sendmail.8
+++ b/contrib/sendmail/src/sendmail.8
@@ -9,9 +9,9 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: sendmail.8,v 8.51 2002/05/24 15:42:13 ca Exp $
+.\" $Id: sendmail.8,v 8.51.2.1 2003/05/20 16:38:15 gshapiro Exp $
.\"
-.TH SENDMAIL 8 "$Date: 2001/03/23 22:10:00 $"
+.TH SENDMAIL 8 "$Date: 2003/05/20 16:38:15 $"
.SH NAME
sendmail
\- an electronic mail transport agent
@@ -295,21 +295,21 @@ Process jobs in queue group called
.I name
only.
.TP
-\fB\-q\fR[\fI!\fR]I substr
+\fB\-q\fR[\fI!\fR]I\fIsubstr\fR
Limit processed jobs to those containing
.I substr
as a substring of the queue id or not when
.I !
is specified.
.TP
-\fB\-q\fR[\fI!\fR]R substr
+\fB\-q\fR[\fI!\fR]R\fIsubstr\fR
Limit processed jobs to those containing
.I substr
as a substring of one of the recipients or not when
.I !
is specified.
.TP
-\fB\-q\fR[\fI!\fR]S substr
+\fB\-q\fR[\fI!\fR]S\fIsubstr\fR
Limit processed jobs to those containing
.I substr
as a substring of the sender or not when
OpenPOWER on IntegriCloud