summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2008-08-28 06:08:29 +0000
committergshapiro <gshapiro@FreeBSD.org>2008-08-28 06:08:29 +0000
commitb1e5c9c5e51c0569a82ee5838ed755e3c7bae94f (patch)
tree45eaace561ffa22220b192fa6cc9bd930b44ffb6 /contrib/sendmail/src
parentdb890a1eb5b814a0367ca9de9f9a8f211f1231e7 (diff)
downloadFreeBSD-src-b1e5c9c5e51c0569a82ee5838ed755e3c7bae94f.zip
FreeBSD-src-b1e5c9c5e51c0569a82ee5838ed755e3c7bae94f.tar.gz
Merge sendmail 8.14.3 into HEAD.
Note: As the first merge since the conversion to svn, it includes many propset changes to get the proper svn:eol-style and svn:mime-type on the files (as merged from the fixed up vendor/dist area). MFC after: 3 days
Diffstat (limited to 'contrib/sendmail/src')
-rw-r--r--contrib/sendmail/src/Makefile.m42
-rw-r--r--contrib/sendmail/src/README8
-rw-r--r--contrib/sendmail/src/collect.c5
-rw-r--r--contrib/sendmail/src/conf.c24
-rw-r--r--contrib/sendmail/src/conf.h3
-rw-r--r--contrib/sendmail/src/daemon.c18
-rw-r--r--contrib/sendmail/src/envelope.c16
-rw-r--r--contrib/sendmail/src/err.c1
-rw-r--r--contrib/sendmail/src/headers.c1
-rw-r--r--contrib/sendmail/src/mailq.11
-rw-r--r--contrib/sendmail/src/main.c14
-rw-r--r--contrib/sendmail/src/mci.c30
-rw-r--r--contrib/sendmail/src/parseaddr.c9
-rw-r--r--contrib/sendmail/src/queue.c8
-rw-r--r--contrib/sendmail/src/ratectrl.c4
-rw-r--r--contrib/sendmail/src/readcf.c20
-rw-r--r--contrib/sendmail/src/savemail.c2
-rw-r--r--contrib/sendmail/src/sendmail.h20
-rw-r--r--contrib/sendmail/src/sfsasl.c28
-rw-r--r--contrib/sendmail/src/sm_resolve.c6
-rw-r--r--contrib/sendmail/src/srvrsmtp.c53
-rw-r--r--contrib/sendmail/src/usersmtp.c5
-rw-r--r--contrib/sendmail/src/util.c9
-rw-r--r--contrib/sendmail/src/version.c6
24 files changed, 205 insertions, 88 deletions
diff --git a/contrib/sendmail/src/Makefile.m4 b/contrib/sendmail/src/Makefile.m4
index b2bfa1a..fd015b4 100644
--- a/contrib/sendmail/src/Makefile.m4
+++ b/contrib/sendmail/src/Makefile.m4
@@ -1,4 +1,4 @@
-dnl $Id: Makefile.m4,v 8.112 2007/10/17 21:29:43 ca Exp $
+dnl $Id: Makefile.m4,v 8.115 2008/03/27 16:13:33 ca Exp $
include(confBUILDTOOLSDIR`/M4/switch.m4')
define(`confREQUIRE_LIBSM', `true')
diff --git a/contrib/sendmail/src/README b/contrib/sendmail/src/README
index 2039674..34313fc 100644
--- a/contrib/sendmail/src/README
+++ b/contrib/sendmail/src/README
@@ -9,7 +9,7 @@
# the sendmail distribution.
#
#
-# $Id: README,v 8.390 2006/11/13 22:27:27 ca Exp $
+# $Id: README,v 8.391 2008/02/12 16:38:21 ca Exp $
#
This directory contains the source files for sendmail(TM).
@@ -41,7 +41,7 @@ Sendmail is a trademark of Sendmail, Inc.
By far, the easiest way to compile sendmail is to use the "Build"
script:
- sh Build
+ sh ./Build
This uses the "uname" command to figure out what architecture you are
on and creates a proper Makefile accordingly. It also creates a
@@ -52,7 +52,7 @@ read the note below in the OPERATING SYSTEM AND COMPILE QUIRKS section.
If you need to look at other include or library directories, use the
-I or -L flags on the command line, e.g.,
- sh Build -I/usr/sww/include -L/usr/sww/lib
+ sh ./Build -I/usr/sww/include -L/usr/sww/lib
It's also possible to create local site configuration in the file
site.config.m4 (or another file settable with the -f flag). This
@@ -1847,4 +1847,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.390 $, last update $Date: 2006/11/13 22:27:27 $ )
+(Version $Revision: 8.391 $, last update $Date: 2008/02/12 16:38:21 $ )
diff --git a/contrib/sendmail/src/collect.c b/contrib/sendmail/src/collect.c
index 56fed0a..0a2cdab 100644
--- a/contrib/sendmail/src/collect.c
+++ b/contrib/sendmail/src/collect.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2006, 2008 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: collect.c,v 8.280 2006/11/29 00:20:40 ca Exp $")
+SM_RCSID("@(#)$Id: collect.c,v 8.282 2008/01/31 18:48:29 ca Exp $")
static void eatfrom __P((char *volatile, ENVELOPE *));
static void collect_doheader __P((ENVELOPE *));
@@ -308,6 +308,7 @@ collect(fp, smtpmode, hdrp, e, rsetsize)
dbto = smtpmode ? ((int) TimeOuts.to_datablock * 1000)
: SM_TIME_FOREVER;
sm_io_setinfo(fp, SM_IO_WHAT_TIMEOUT, &dbto);
+ set_tls_rd_tmo(TimeOuts.to_datablock);
c = SM_IO_EOF;
inputerr = false;
headeronly = hdrp != NULL;
diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c
index e892cef..bf97057 100644
--- a/contrib/sendmail/src/conf.c
+++ b/contrib/sendmail/src/conf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -9,12 +9,11 @@
* 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.1136 2007/10/10 00:06:45 ca Exp $")
+SM_RCSID("@(#)$Id: conf.c,v 8.1141 2008/04/14 02:09:35 ca Exp $")
#include <sm/sendmail.h>
#include <sendmail/pathnames.h>
@@ -1514,7 +1513,7 @@ getla()
sm_dprintf("getla: symbol address = %#lx\n",
(unsigned long) Nl[X_AVENRUN].n_value);
if (lseek(kmem, (off_t) Nl[X_AVENRUN].n_value, SEEK_SET) == -1 ||
- read(kmem, (char *) avenrun, sizeof(avenrun)) < sizeof(avenrun))
+ read(kmem, (char *) avenrun, sizeof(avenrun)) != sizeof(avenrun))
{
/* thank you Ian */
if (tTd(3, 1))
@@ -1836,7 +1835,7 @@ getla(void)
if (lseek(kmem, CAST_SYSMP(sysmp(MP_KERNADDR, MPKA_AVENRUN)), SEEK_SET)
== -1 ||
- read(kmem, (char *) avenrun, sizeof(avenrun)) < sizeof(avenrun))
+ read(kmem, (char *) avenrun, sizeof(avenrun)) != sizeof(avenrun))
{
if (tTd(3, 1))
sm_dprintf("getla: lseek or read: %s\n",
@@ -1944,6 +1943,13 @@ getla()
}
r = read(afd, &avenrun, sizeof(avenrun));
+ if (r != sizeof(avenrun))
+ {
+ sm_syslog(LOG_ERR, NOQID,
+ "can't read %s: %s", _PATH_AVENRUN,
+ r == -1 ? sm_errstring(errno) : "short read");
+ return -1;
+ }
if (tTd(3, 5))
sm_dprintf("getla: avenrun = %d\n", avenrun);
@@ -6025,6 +6031,10 @@ char *FFRCompileOptions[] =
/* DefaultAuthInfo doesn't really work in 8.13 anymore. */
"_FFR_ALLOW_SASLINFO",
#endif /* _FFR_ALLOW_SASLINFO */
+#if _FFR_BADRCPT_SHUTDOWN
+ /* shut down connection (421) if there are too many bad RCPTs */
+ "_FFR_BADRCPT_SHUTDOWN",
+#endif /* _FFR_BADRCPT_SHUTDOWN */
#if _FFR_BESTMX_BETTER_TRUNCATION
/* Better truncation of list of MX records for dns map. */
"_FFR_BESTMX_BETTER_TRUNCATION",
@@ -6165,6 +6175,10 @@ char *FFRCompileOptions[] =
/* Ignore extensions offered in response to HELO */
"_FFR_IGNORE_EXT_ON_HELO",
#endif /* _FFR_IGNORE_EXT_ON_HELO */
+#if _FFR_LOCAL_DAEMON
+ /* Local daemon mode (-bl) which only accepts loopback connections */
+ "_FFR_LOCAL_DAEMON",
+#endif /* _FFR_LOCAL_DAEMON */
#if _FFR_MAXDATASIZE
/*
** It is possible that a header is larger than MILTER_CHUNK_SIZE,
diff --git a/contrib/sendmail/src/conf.h b/contrib/sendmail/src/conf.h
index 99ed47d..f1386c4 100644
--- a/contrib/sendmail/src/conf.h
+++ b/contrib/sendmail/src/conf.h
@@ -11,9 +11,6 @@
*
*
* $Id: conf.h,v 8.574 2006/11/29 00:36:06 ca Exp $
- *
- * $FreeBSD$
- *
*/
/*
diff --git a/contrib/sendmail/src/daemon.c b/contrib/sendmail/src/daemon.c
index 76b5b58..06a36c7 100644
--- a/contrib/sendmail/src/daemon.c
+++ b/contrib/sendmail/src/daemon.c
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include "map.h"
-SM_RCSID("@(#)$Id: daemon.c,v 8.678 2007/03/08 00:33:40 ca Exp $")
+SM_RCSID("@(#)$Id: daemon.c,v 8.680 2008/02/14 00:20:26 ca Exp $")
#if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__)
# define USE_SOCK_STREAM 1
@@ -1257,7 +1257,8 @@ setupdaemon(daemonaddr)
#if NETINET
case AF_INET:
if (daemonaddr->sin.sin_addr.s_addr == 0)
- daemonaddr->sin.sin_addr.s_addr = INADDR_ANY;
+ daemonaddr->sin.sin_addr.s_addr =
+ LocalDaemon ? htonl(INADDR_LOOPBACK) : INADDR_ANY;
port = daemonaddr->sin.sin_port;
break;
#endif /* NETINET */
@@ -1265,7 +1266,8 @@ setupdaemon(daemonaddr)
#if NETINET6
case AF_INET6:
if (IN6_IS_ADDR_UNSPECIFIED(&daemonaddr->sin6.sin6_addr))
- daemonaddr->sin6.sin6_addr = in6addr_any;
+ daemonaddr->sin6.sin6_addr =
+ LocalDaemon ? in6addr_loopback : in6addr_any;
port = daemonaddr->sin6.sin6_port;
break;
#endif /* NETINET6 */
@@ -2204,7 +2206,8 @@ makeconnection(host, port, mci, e, enough)
#if NETINET
case AF_INET:
if (clt_addr.sin.sin_addr.s_addr == 0)
- clt_addr.sin.sin_addr.s_addr = INADDR_ANY;
+ clt_addr.sin.sin_addr.s_addr = LocalDaemon ?
+ htonl(INADDR_LOOPBACK) : INADDR_ANY;
else
clt_bind = true;
if (clt_addr.sin.sin_port != 0)
@@ -2215,7 +2218,8 @@ makeconnection(host, port, mci, e, enough)
#if NETINET6
case AF_INET6:
if (IN6_IS_ADDR_UNSPECIFIED(&clt_addr.sin6.sin6_addr))
- clt_addr.sin6.sin6_addr = in6addr_any;
+ clt_addr.sin6.sin6_addr = LocalDaemon ?
+ in6addr_loopback : in6addr_any;
else
clt_bind = true;
socksize = sizeof(struct sockaddr_in6);
@@ -3274,7 +3278,7 @@ myhostname(hostbuf, size)
if (strchr(hostbuf, '.') == NULL &&
!getcanonname(hostbuf, size, true, NULL))
{
- sm_syslog(LOG_CRIT, NOQID,
+ sm_syslog(LocalDaemon ? LOG_WARNING : LOG_CRIT, NOQID,
"My unqualified host name (%s) unknown; sleeping for retry",
hostbuf);
message("My unqualified host name (%s) unknown; sleeping for retry",
@@ -3282,7 +3286,7 @@ myhostname(hostbuf, size)
(void) sleep(60);
if (!getcanonname(hostbuf, size, true, NULL))
{
- sm_syslog(LOG_ALERT, NOQID,
+ sm_syslog(LocalDaemon ? LOG_WARNING : LOG_ALERT, NOQID,
"unable to qualify my own domain name (%s) -- using short name",
hostbuf);
message("WARNING: unable to qualify my own domain name (%s) -- using short name",
diff --git a/contrib/sendmail/src/envelope.c b/contrib/sendmail/src/envelope.c
index 20b0ba2..641c621a 100644
--- a/contrib/sendmail/src/envelope.c
+++ b/contrib/sendmail/src/envelope.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: envelope.c,v 8.304 2007/04/18 17:15:49 ca Exp $")
+SM_RCSID("@(#)$Id: envelope.c,v 8.305 2008/03/31 16:32:13 ca Exp $")
/*
** CLRSESSENVELOPE -- clear session oriented data in an envelope
@@ -75,7 +75,7 @@ newenvelope(e, parent, rpool)
register ENVELOPE *parent;
SM_RPOOL_T *rpool;
{
- int sendmode, dm;
+ int sendmode;
/*
** This code used to read:
@@ -86,16 +86,8 @@ newenvelope(e, parent, rpool)
** This meant macvalue() could go into an infinite loop.
*/
- dm = DM_NOTSET;
if (parent != NULL)
- {
- char *str;
-
sendmode = parent->e_sendmode;
- str = macvalue(macid("{deliveryMode}"), parent);
- if (str != NULL)
- dm = (int) str[0];
- }
else
sendmode = DM_NOTSET;
@@ -144,9 +136,7 @@ newenvelope(e, parent, rpool)
if (CurEnv->e_xfp != NULL)
(void) sm_io_flush(CurEnv->e_xfp, SM_TIME_DEFAULT);
if (sendmode != DM_NOTSET)
- e->e_sendmode = sendmode;
- if (dm != DM_NOTSET)
- set_delivery_mode(dm, e);
+ set_delivery_mode(sendmode, e);
return e;
}
diff --git a/contrib/sendmail/src/err.c b/contrib/sendmail/src/err.c
index 89b0736..5825666 100644
--- a/contrib/sendmail/src/err.c
+++ b/contrib/sendmail/src/err.c
@@ -9,7 +9,6 @@
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
- * $FreeBSD$
*/
#include <sendmail.h>
diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c
index 7e223db..8e70fed 100644
--- a/contrib/sendmail/src/headers.c
+++ b/contrib/sendmail/src/headers.c
@@ -9,7 +9,6 @@
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
- * $FreeBSD$
*/
#include <sendmail.h>
diff --git a/contrib/sendmail/src/mailq.1 b/contrib/sendmail/src/mailq.1
index 6b2136f..62f123c 100644
--- a/contrib/sendmail/src/mailq.1
+++ b/contrib/sendmail/src/mailq.1
@@ -133,4 +133,3 @@ The
.B mailq
command appeared in
4.0BSD.
-.\" $FreeBSD$
diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c
index 8680add..d68d5b5 100644
--- a/contrib/sendmail/src/main.c
+++ b/contrib/sendmail/src/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2006, 2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -26,7 +26,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.963 2007/06/29 20:07:37 ca Exp $")
+SM_RCSID("@(#)$Id: main.c,v 8.967 2008/03/31 16:32:13 ca Exp $")
#if NETINET || NETINET6
@@ -302,6 +302,9 @@ main(argc, argv, envp)
ExitStat = EX_OK;
SubmitMode = SUBMIT_UNKNOWN;
+#if _FFR_LOCAL_DAEMON
+ LocalDaemon = false;
+#endif /* _FFR_LOCAL_DAEMON */
#if XDEBUG
checkfd012("after openlog");
#endif /* XDEBUG */
@@ -401,6 +404,13 @@ main(argc, argv, envp)
OpMode = j;
break;
+#if _FFR_LOCAL_DAEMON
+ case MD_LOCAL:
+ OpMode = MD_DAEMON;
+ LocalDaemon = true;
+ break;
+#endif /* _FFR_LOCAL_DAEMON */
+
case MD_FREEZE:
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
"Frozen configurations unsupported\n");
diff --git a/contrib/sendmail/src/mci.c b/contrib/sendmail/src/mci.c
index ef977440..2770117 100644
--- a/contrib/sendmail/src/mci.c
+++ b/contrib/sendmail/src/mci.c
@@ -9,12 +9,11 @@
* 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.218 2006/08/15 23:24:57 ca Exp $")
+SM_RCSID("@(#)$Id: mci.c,v 8.221 2007/11/13 23:44:25 gshapiro Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -1144,16 +1143,27 @@ mci_traverse_persistent(action, pathname)
pathname, sm_errstring(errno));
return -1;
}
- len = sizeof(newpath) - MAXNAMLEN - 3;
+
+ /*
+ ** Reserve space for trailing '/', at least one
+ ** character, and '\0'
+ */
+
+ len = sizeof(newpath) - 3;
if (sm_strlcpy(newpath, pathname, len) >= len)
{
+ int save_errno = errno;
+
if (tTd(56, 2))
sm_dprintf("mci_traverse: path \"%s\" too long",
pathname);
+ (void) closedir(d);
+ errno = save_errno;
return -1;
}
newptr = newpath + strlen(newpath);
*newptr++ = '/';
+ len = sizeof(newpath) - (newptr - newpath);
/*
** repeat until no file has been removed
@@ -1170,9 +1180,17 @@ mci_traverse_persistent(action, pathname)
if (e->d_name[0] == '.')
continue;
- (void) sm_strlcpy(newptr, e->d_name,
- sizeof(newpath) -
- (newptr - newpath));
+ if (sm_strlcpy(newptr, e->d_name, len) >= len)
+ {
+ /* Skip truncated copies */
+ if (tTd(56, 4))
+ {
+ *newptr = '\0';
+ sm_dprintf("mci_traverse: path \"%s%s\" too long",
+ newpath, e->d_name);
+ }
+ continue;
+ }
if (StopRequest)
stop_sendmail();
diff --git a/contrib/sendmail/src/parseaddr.c b/contrib/sendmail/src/parseaddr.c
index eca60f9..19bcf73 100644
--- a/contrib/sendmail/src/parseaddr.c
+++ b/contrib/sendmail/src/parseaddr.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: parseaddr.c,v 8.401 2007/09/27 23:33:59 ca Exp $")
+SM_RCSID("@(#)$Id: parseaddr.c,v 8.403 2008/02/08 02:27:35 ca Exp $")
#include <sm/sendmail.h>
#include "map.h"
@@ -1460,6 +1460,7 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
size_t trsize;
char *replac;
int endtoken;
+ bool external;
STAB *map;
char *mapname;
char **key_rvp;
@@ -1575,6 +1576,7 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
true);
argvect[0] = cbuf;
replac = map_lookup(map, cbuf, argvect, &rstat, e);
+ external = replac != NULL;
/* if no replacement, use default */
if (replac == NULL && default_rvp != NULL)
@@ -1599,7 +1601,8 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
{
/* scan the new replacement */
xpvp = prescan(replac, '\0', pvpbuf,
- sizeof(pvpbuf), NULL, NULL,
+ sizeof(pvpbuf), NULL,
+ external ? NULL : IntTokenTab,
false);
if (xpvp == NULL)
{
@@ -2263,7 +2266,7 @@ cataddr(pvp, evp, buf, sz, spacesub, external)
{
char *q;
- natomtok = (ExtTokenTab[**pvp & 0xff] == ATM);
+ natomtok = (IntTokenTab[**pvp & 0xff] == ATM);
if (oatomtok && natomtok)
{
*p++ = spacesub;
diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c
index e80a035..d4c6369 100644
--- a/contrib/sendmail/src/queue.c
+++ b/contrib/sendmail/src/queue.c
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <sm/sem.h>
-SM_RCSID("@(#)$Id: queue.c,v 8.975 2007/06/18 20:08:40 ca Exp $")
+SM_RCSID("@(#)$Id: queue.c,v 8.977 2008/02/15 23:19:58 ca Exp $")
#include <dirent.h>
@@ -4514,7 +4514,7 @@ readqf(e, openonly)
(void) sm_io_close(qfp, SM_TIME_DEFAULT);
return false;
}
-
+
#if _FFR_QF_PARANOIA
/* Check to make sure key fields were read */
if (e->e_from.q_mailer == NULL)
@@ -6596,8 +6596,8 @@ init_sem(owner)
if (SemId < 0)
{
sm_syslog(LOG_ERR, NOQID,
- "func=init_sem, sem_key=%ld, sm_sem_start=%d",
- (long) SemKey, SemId);
+ "func=init_sem, sem_key=%ld, sm_sem_start=%d, error=%s",
+ (long) SemKey, SemId, sm_errstring(-SemId));
return;
}
#endif /* SM_CONF_SEM */
diff --git a/contrib/sendmail/src/ratectrl.c b/contrib/sendmail/src/ratectrl.c
index 22f9803..8b95b37 100644
--- a/contrib/sendmail/src/ratectrl.c
+++ b/contrib/sendmail/src/ratectrl.c
@@ -45,7 +45,7 @@
*/
#include <sendmail.h>
-SM_RCSID("@(#)$Id: ratectrl.c,v 8.11 2006/08/15 23:24:57 ca Exp $")
+SM_RCSID("@(#)$Id: ratectrl.c,v 8.12 2008/02/11 22:56:05 ca Exp $")
/*
** stuff included - given some warnings (inet_ntoa)
@@ -114,7 +114,7 @@ connection_rate_check(hostaddr, e)
/* update server connection rate */
totalrate = total_rate(now, e == NULL);
#if RATECTL_DEBUG
- sm_syslog(LOG_INFO, NOQID, "global connection rate: %d", globalRate);
+ sm_syslog(LOG_INFO, NOQID, "global connection rate: %d", totalrate);
#endif /* RATECTL_DEBUG */
/* update client connection rate */
diff --git a/contrib/sendmail/src/readcf.c b/contrib/sendmail/src/readcf.c
index 0d0849b..445df9e 100644
--- a/contrib/sendmail/src/readcf.c
+++ b/contrib/sendmail/src/readcf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2006, 2008 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 <sm/sendmail.h>
-SM_RCSID("@(#)$Id: readcf.c,v 8.664 2007/07/10 17:01:22 ca Exp $")
+SM_RCSID("@(#)$Id: readcf.c,v 8.666 2008/02/14 17:25:14 ca Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -2249,6 +2249,12 @@ static struct optioninfo
# define O_ADDR_TYPE_MODES 0xe0
{ "AddrTypeModes", O_ADDR_TYPE_MODES, OI_NONE },
#endif /* _FFR_ADDR_TYPE_MODES */
+#if _FFR_BADRCPT_SHUTDOWN
+# define O_RCPTSHUTD 0xe1
+ { "BadRcptShutdown", O_RCPTSHUTD, OI_SAFE },
+# define O_RCPTSHUTDG 0xe2
+ { "BadRcptShutdownGood", O_RCPTSHUTDG, OI_SAFE },
+#endif /* _FFR_BADRCPT_SHUTDOWN */
{ NULL, '\0', OI_NONE }
};
@@ -3817,6 +3823,16 @@ setoption(opt, val, safe, sticky, e)
break;
#endif /* _FFR_ADDR_TYPE_MODES */
+#if _FFR_BADRCPT_SHUTDOWN
+ case O_RCPTSHUTD:
+ BadRcptShutdown = atoi(val);
+ break;
+
+ case O_RCPTSHUTDG:
+ BadRcptShutdownGood = atoi(val);
+ break;
+#endif /* _FFR_BADRCPT_SHUTDOWN */
+
default:
if (tTd(37, 1))
{
diff --git a/contrib/sendmail/src/savemail.c b/contrib/sendmail/src/savemail.c
index 7c7f288..cf72e8d 100644
--- a/contrib/sendmail/src/savemail.c
+++ b/contrib/sendmail/src/savemail.c
@@ -9,8 +9,6 @@
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
- * $FreeBSD$
- *
*/
#include <sendmail.h>
diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h
index 82ab6a9..88607e6 100644
--- a/contrib/sendmail/src/sendmail.h
+++ b/contrib/sendmail/src/sendmail.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -52,7 +52,7 @@
#ifdef _DEFINE
# ifndef lint
-SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1052 2007/10/05 23:06:30 ca Exp $";
+SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1059 2008/02/15 23:19:58 ca Exp $";
# endif /* ! lint */
#endif /* _DEFINE */
@@ -1551,6 +1551,7 @@ extern void stabapply __P((void (*)(STAB *, int), int));
#define MD_ARPAFTP 'a' /* obsolete ARPANET mode (Grey Book) */
#define MD_DAEMON 'd' /* run as a daemon */
#define MD_FGDAEMON 'D' /* run daemon in foreground */
+#define MD_LOCAL 'l' /* like daemon, but localhost only */
#define MD_VERIFY 'v' /* verify: don't collect or deliver */
#define MD_TEST 't' /* test mode: resolve addrs only */
#define MD_INITALIAS 'i' /* initialize alias database */
@@ -1561,6 +1562,12 @@ extern void stabapply __P((void (*)(STAB *, int), int));
#define MD_PURGESTAT 'H' /* purge persistent host stat info */
#define MD_QUEUERUN 'q' /* queue run */
+#if _FFR_LOCAL_DAEMON
+EXTERN bool LocalDaemon;
+#else /* _FFR_LOCAL_DAEMON */
+# define LocalDaemon false
+#endif /* _FFR_LOCAL_DAEMON */
+
/* Note: see also include/sendmail/pathnames.h: GET_CLIENT_CF */
/* values for e_sendmode -- send modes */
@@ -2229,6 +2236,10 @@ EXTERN char InetMode; /* default network for daemon mode */
EXTERN char OpMode; /* operation mode, see below */
EXTERN char SpaceSub; /* substitution for <lwsp> */
EXTERN int BadRcptThrottle; /* Throttle rejected RCPTs per SMTP message */
+#if _FFR_BADRCPT_SHUTDOWN
+EXTERN int BadRcptShutdown; /* Shutdown connection for rejected RCPTs */
+EXTERN int BadRcptShutdownGood; /* above even when there are good RCPTs */
+#endif /* _FFR_BADRCPT_SHUTDOWN */
EXTERN int CheckpointInterval; /* queue file checkpoint interval */
EXTERN int ConfigLevel; /* config file level */
EXTERN int ConnRateThrottle; /* throttle for SMTP connection rate */
@@ -2590,6 +2601,11 @@ extern void setoption __P((int, char *, bool, bool, ENVELOPE *));
extern sigfunc_t setsignal __P((int, sigfunc_t));
extern void sm_setuserenv __P((const char *, const char *));
extern void settime __P((ENVELOPE *));
+#if STARTTLS
+extern void set_tls_rd_tmo __P((int));
+#else /* STARTTLS */
+#define set_tls_rd_tmo(rd_tmo)
+#endif /* STARTTLS */
extern char *sfgets __P((char *, int, SM_FILE_T *, time_t, char *));
extern char *shortenstring __P((const char *, size_t));
extern char *shorten_hostname __P((char []));
diff --git a/contrib/sendmail/src/sfsasl.c b/contrib/sendmail/src/sfsasl.c
index 216d87e..67e919f 100644
--- a/contrib/sendmail/src/sfsasl.c
+++ b/contrib/sendmail/src/sfsasl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2006, 2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -9,7 +9,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: sfsasl.c,v 8.115 2006/04/18 21:34:07 ca Exp $")
+SM_RCSID("@(#)$Id: sfsasl.c,v 8.117 2008/01/31 18:48:29 ca Exp $")
#include <stdlib.h>
#include <sendmail.h>
#include <sm/time.h>
@@ -675,6 +675,26 @@ tls_retry(ssl, rfd, wfd, tlsstart, timeout, err, where)
#endif /* ETIMEDOUT */
/*
+** SET_TLS_RD_TMO -- read secured information for the caller
+**
+** Parameters:
+** rd_tmo -- read timeout
+**
+** Results:
+** none
+** This is a hack: there is no way to pass it in
+*/
+
+static int tls_rd_tmo = -1;
+
+void
+set_tls_rd_tmo(rd_tmo)
+ int rd_tmo;
+{
+ tls_rd_tmo = rd_tmo;
+}
+
+/*
** TLS_READ -- read secured information for the caller
**
** Parameters:
@@ -725,7 +745,9 @@ tls_read(fp, buf, size)
rfd = SSL_get_rfd(so->con);
wfd = SSL_get_wfd(so->con);
try = tls_retry(so->con, rfd, wfd, tlsstart,
- TimeOuts.to_datablock, ssl_err, "read");
+ (tls_rd_tmo < 0) ? TimeOuts.to_datablock
+ : tls_rd_tmo,
+ ssl_err, "read");
if (try > 0)
goto retry;
errno = SM_ERR_TIMEOUT;
diff --git a/contrib/sendmail/src/sm_resolve.c b/contrib/sendmail/src/sm_resolve.c
index 035a9e5..6d9c28d 100644
--- a/contrib/sendmail/src/sm_resolve.c
+++ b/contrib/sendmail/src/sm_resolve.c
@@ -46,7 +46,7 @@
# if NAMED_BIND
# include "sm_resolve.h"
-SM_RCSID("$Id: sm_resolve.c,v 8.35 2007/06/25 16:20:14 ca Exp $")
+SM_RCSID("$Id: sm_resolve.c,v 8.36 2008/02/11 23:04:16 ca Exp $")
static struct stot
{
@@ -168,7 +168,7 @@ parse_dns_reply(data, len)
int len;
{
unsigned char *p;
- ushort ans_cnt, ui;
+ unsigned short ans_cnt, ui;
int status;
size_t l;
char host[MAXHOSTNAMELEN];
@@ -198,7 +198,7 @@ parse_dns_reply(data, len)
return NULL;
}
- ans_cnt = ntohs((ushort) r->dns_r_h.ancount);
+ ans_cnt = ntohs((unsigned short) r->dns_r_h.ancount);
p += status;
GETSHORT(r->dns_r_q.dns_q_type, p);
diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c
index 514a5e6..fffcd0d 100644
--- a/contrib/sendmail/src/srvrsmtp.c
+++ b/contrib/sendmail/src/srvrsmtp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -17,7 +17,7 @@
# include <libmilter/mfdef.h>
#endif /* MILTER */
-SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.967 2007/10/01 16:22:14 ca Exp $")
+SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.975 2008/03/31 16:32:13 ca Exp $")
#include <sm/time.h>
#include <sm/fdset.h>
@@ -637,6 +637,9 @@ smtp(nullserver, d_flags, e)
# define p_addr_st NULL
#endif /* MILTER */
size_t inplen;
+#if _FFR_BADRCPT_SHUTDOWN
+ int n_badrcpts_adj;
+#endif /* _FFR_BADRCPT_SHUTDOWN */
SevenBitInput_Saved = SevenBitInput;
smtp.sm_nrcpts = 0;
@@ -903,6 +906,8 @@ smtp(nullserver, d_flags, e)
#endif /* SASL */
#if STARTTLS
+
+ set_tls_rd_tmo(TimeOuts.to_nextcommand);
#endif /* STARTTLS */
#if MILTER
@@ -942,6 +947,7 @@ smtp(nullserver, d_flags, e)
/* arrange to ignore send list */
e->e_sendqueue = NULL;
+ lognullconnection = false;
goto doquit;
}
}
@@ -1054,10 +1060,10 @@ smtp(nullserver, d_flags, e)
if (select(fd + 1, FDSET_CAST &readfds,
NULL, NULL, &timeout) > 0 &&
FD_ISSET(fd, &readfds) &&
- (eoftest = sm_io_getc(InChannel, SM_TIME_DEFAULT))
+ (eoftest = sm_io_getc(InChannel, SM_TIME_DEFAULT))
!= SM_IO_EOF)
{
- sm_io_ungetc(InChannel, SM_TIME_DEFAULT,
+ sm_io_ungetc(InChannel, SM_TIME_DEFAULT,
eoftest);
gettimeofday(&ep, NULL);
timersub(&ep, &bp, &tp);
@@ -2523,6 +2529,36 @@ smtp(nullserver, d_flags, e)
milter_rcpt_added = false;
smtp.sm_e_nrcpts_orig = e->e_nrcpts;
#endif
+#if _FFR_BADRCPT_SHUTDOWN
+ /*
+ ** hack to deal with hack, see below:
+ ** n_badrcpts is increased is limit is reached.
+ */
+
+ n_badrcpts_adj = (BadRcptThrottle > 0 &&
+ n_badrcpts > BadRcptThrottle &&
+ LogLevel > 5)
+ ? n_badrcpts - 1 : n_badrcpts;
+ if (BadRcptShutdown > 0 &&
+ n_badrcpts_adj >= BadRcptShutdown &&
+ (BadRcptShutdownGood == 0 ||
+ smtp.sm_nrcpts == 0 ||
+ (n_badrcpts_adj * 100 /
+ (smtp.sm_nrcpts + n_badrcpts) >=
+ BadRcptShutdownGood)))
+ {
+ if (LogLevel > 5)
+ sm_syslog(LOG_INFO, e->e_id,
+ "%s: Possible SMTP RCPT flood, shutting down connection.",
+ CurSmtpClient);
+ message("421 4.7.0 %s Too many bad recipients; closing connection",
+ MyHostName);
+
+ /* arrange to ignore any current send list */
+ e->e_sendqueue = NULL;
+ goto doquit;
+ }
+#endif /* _FFR_BADRCPT_SHUTDOWN */
if (BadRcptThrottle > 0 &&
n_badrcpts >= BadRcptThrottle)
{
@@ -3775,17 +3811,10 @@ smtp_data(smtp, e)
dropenvelope(ee, true, false);
}
}
- sm_rpool_free(e->e_rpool);
-
- /*
- ** At this point, e == &MainEnvelope, but if we did splitting,
- ** then CurEnv may point to an envelope structure that was just
- ** freed with the rpool. So reset CurEnv *before* calling
- ** newenvelope.
- */
CurEnv = e;
features = e->e_features;
+ sm_rpool_free(e->e_rpool);
newenvelope(e, e, sm_rpool_new_x(NULL));
e->e_flags = BlankEnvelope.e_flags;
e->e_features = features;
diff --git a/contrib/sendmail/src/usersmtp.c b/contrib/sendmail/src/usersmtp.c
index 724f10c..b29495c 100644
--- a/contrib/sendmail/src/usersmtp.c
+++ b/contrib/sendmail/src/usersmtp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2006, 2008 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: usersmtp.c,v 8.470 2007/10/17 21:35:30 ca Exp $")
+SM_RCSID("@(#)$Id: usersmtp.c,v 8.472 2008/01/31 18:48:29 ca Exp $")
#include <sysexits.h>
@@ -3077,6 +3077,7 @@ reply(m, mci, e, timeout, pfunc, enhstat, rtype)
*/
bufp = SmtpReplyBuffer;
+ set_tls_rd_tmo(timeout);
for (;;)
{
register char *p;
diff --git a/contrib/sendmail/src/util.c b/contrib/sendmail/src/util.c
index 95d2f9a..dab5961 100644
--- a/contrib/sendmail/src/util.c
+++ b/contrib/sendmail/src/util.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: util.c,v 8.413 2007/09/26 23:29:11 ca Exp $")
+SM_RCSID("@(#)$Id: util.c,v 8.414 2007/11/02 17:30:38 ca Exp $")
#include <sm/sendmail.h>
#include <sysexits.h>
@@ -2823,9 +2823,10 @@ count_open_connections(hostaddr)
return 0;
/*
- ** Initialize to 1 instead of 0 because this code gets called
- ** before proc_list_add() gets called, so we (the daemon child
- ** for this connection) don't count ourselves.
+ ** This code gets called before proc_list_add() gets called,
+ ** so we (the daemon child for this connection) have not yet
+ ** counted ourselves. Hence initialize the counter to 1
+ ** instead of 0 to compensate.
*/
n = 1;
diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c
index ee09fc9..3e5ee8e 100644
--- a/contrib/sendmail/src/version.c
+++ b/contrib/sendmail/src/version.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2008 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.199 2007/10/31 16:04:12 ca Exp $")
+SM_RCSID("@(#)$Id: version.c,v 8.208 2008/04/17 17:04:30 ca Exp $")
-char Version[] = "8.14.2";
+char Version[] = "8.14.3";
OpenPOWER on IntegriCloud