summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2003-02-08 20:31:29 +0000
committergshapiro <gshapiro@FreeBSD.org>2003-02-08 20:31:29 +0000
commit842b56b9cabf175e7842ec5a3b29ff68353b3177 (patch)
tree2e81c43d391ed220f6656502de14ddfbb0de4ecd /contrib/sendmail/src
parent39e311b2e17a53f7ed02fcbe3820ca77b65486d5 (diff)
downloadFreeBSD-src-842b56b9cabf175e7842ec5a3b29ff68353b3177.zip
FreeBSD-src-842b56b9cabf175e7842ec5a3b29ff68353b3177.tar.gz
Import sendmail 8.12.7
Diffstat (limited to 'contrib/sendmail/src')
-rw-r--r--contrib/sendmail/src/Makefile.m43
-rw-r--r--contrib/sendmail/src/README51
-rw-r--r--contrib/sendmail/src/SECURITY5
-rw-r--r--contrib/sendmail/src/TRACEFLAGS7
-rw-r--r--contrib/sendmail/src/collect.c12
-rw-r--r--contrib/sendmail/src/conf.c64
-rw-r--r--contrib/sendmail/src/conf.h5
-rw-r--r--contrib/sendmail/src/control.c10
-rw-r--r--contrib/sendmail/src/daemon.c76
-rw-r--r--contrib/sendmail/src/deliver.c45
-rw-r--r--contrib/sendmail/src/envelope.c42
-rw-r--r--contrib/sendmail/src/headers.c6
-rw-r--r--contrib/sendmail/src/mailq.126
-rw-r--r--contrib/sendmail/src/main.c50
-rw-r--r--contrib/sendmail/src/map.c59
-rw-r--r--contrib/sendmail/src/mci.c4
-rw-r--r--contrib/sendmail/src/milter.c44
-rw-r--r--contrib/sendmail/src/parseaddr.c3
-rw-r--r--contrib/sendmail/src/queue.c136
-rw-r--r--contrib/sendmail/src/readcf.c52
-rw-r--r--contrib/sendmail/src/recipient.c4
-rw-r--r--contrib/sendmail/src/sasl.c4
-rw-r--r--contrib/sendmail/src/savemail.c22
-rw-r--r--contrib/sendmail/src/sendmail.h62
-rw-r--r--contrib/sendmail/src/sfsasl.c8
-rw-r--r--contrib/sendmail/src/srvrsmtp.c163
-rw-r--r--contrib/sendmail/src/sysexits.c11
-rw-r--r--contrib/sendmail/src/tls.c32
-rw-r--r--contrib/sendmail/src/trace.c4
-rw-r--r--contrib/sendmail/src/udb.c20
-rw-r--r--contrib/sendmail/src/usersmtp.c21
-rw-r--r--contrib/sendmail/src/util.c34
-rw-r--r--contrib/sendmail/src/version.c4
33 files changed, 747 insertions, 342 deletions
diff --git a/contrib/sendmail/src/Makefile.m4 b/contrib/sendmail/src/Makefile.m4
index 6143bbe..1100dea 100644
--- a/contrib/sendmail/src/Makefile.m4
+++ b/contrib/sendmail/src/Makefile.m4
@@ -1,4 +1,4 @@
-dnl $Id: Makefile.m4,v 8.91.2.3 2002/07/29 22:08:09 gshapiro Exp $
+dnl $Id: Makefile.m4,v 8.91.2.4 2002/09/09 02:48:54 gshapiro Exp $
include(confBUILDTOOLSDIR`/M4/switch.m4')
define(`confREQUIRE_LIBSM', `true')
@@ -40,7 +40,6 @@ bldPUSH_TARGET(`statistics')
divert(bldTARGETS_SECTION)
statistics:
${CP} /dev/null statistics
- chmod ifdef(`confSTMODE', `confSTMODE', `0600') statistics
${DESTDIR}/etc/mail/submit.cf:
@echo "Please read INSTALL if anything fails while installing the binary."
diff --git a/contrib/sendmail/src/README b/contrib/sendmail/src/README
index b8c31ec..bb0dc157 100644
--- a/contrib/sendmail/src/README
+++ b/contrib/sendmail/src/README
@@ -9,7 +9,7 @@
# the sendmail distribution.
#
#
-# $Id: README,v 8.355.2.3 2002/06/21 22:44:56 gshapiro Exp $
+# $Id: README,v 8.355.2.11 2002/12/18 17:15:46 ca Exp $
#
This directory contains the source files for sendmail(TM).
@@ -102,6 +102,8 @@ NEWDB The new Berkeley DB package. Some systems (e.g., BSD/OS and
Berkeley DB library to a current version. NEWDB is included
automatically if the Build script can find a library named
libdb.a or libdb.so.
+ See also OPERATING SYSTEM AND COMPILE QUIRKS about Berkeley
+ DB versions, e.g., DB 4.1.x.
NDBM The older NDBM implementation -- the very old V7 DBM
implementation is no longer supported.
NIS Network Information Services. To use this you must have
@@ -597,10 +599,15 @@ MILTER Turn on support for external filters using the Milter API.
See libmilter/README for more information.
REQUIRES_DIR_FSYNC Turn on support for file systems that require to
call fsync() for a directory if the meta-data in it has
- been changed. This should be turned on at least for
- ReiserFS; it is enabled by default for Linux. An alternative
- to this compile time flag is to mount the queue directory
- without the -async option, or using chattr +S on Linux.
+ been changed. This should be turned on at least for older
+ versions of ReiserFS; it is enabled by default for Linux.
+ According to some information this flag is not needed
+ anymore for kernel 2.4.16 and newer. We would appreciate
+ feedback about the semantics of the various file systems
+ available for Linux.
+ An alternative to this compile time flag is to mount the
+ queue directory without the -async option, or using
+ chattr +S on Linux.
DBMMODE The default file permissions to use when creating new
database files for maps and aliases. Defaults to 0640.
@@ -679,6 +686,20 @@ and try again. Then take a look at the logfile and see whether
there are any problems listed about permissions (unsafe files)
or the validity of X.509 certificates.
+From: Garrett Wollman <wollman@lcs.mit.edu>
+
+ If your certificate authority is hierarchical, and you only include
+ the top-level CA certificate in the CACertFile file, some mail clients
+ may be unable to infer the proper certificate chain when selecting a
+ client certificate. Including the bottom-level CA certificate(s) in
+ the CACertFile file will allow these clients to work properly. This
+ is not necessary if you are not using client certificates for
+ authentication, or if all your clients are running Sendmail or other
+ programs using the OpenSSL library (which get it right automatically).
+ In addition, some mail clients are totally incapable of using
+ certificate authentication -- even some of those which already support
+ SSL/TLS for confidentiality.
+
Further information can be found via:
http://www.sendmail.org/tips/
@@ -690,7 +711,7 @@ http://www.sendmail.org/tips/
Please read the documentation accompanying the Cyrus SASL library
(INSTALL and README). If you use Berkeley DB for Cyrus SASL then
you must compile sendmail with the same version of Berkeley DB.
-See devtools/README how to set the correct compile time parameters;
+See devtools/README for how to set the correct compile time parameters;
you should at least set the following variables:
APPENDDEF(`conf_sendmail_ENVDEF', `-DSASL')
@@ -703,7 +724,7 @@ BUILDING SENDMAIL.
You have to select and install authentication mechanisms and tell
sendmail where to find the sasl library and the include files (see
-devtools/README for the parameters to set). Setup the required
+devtools/README for the parameters to set). Set up the required
users and passwords as explained in the SASL documentation. See
also cf/README for authentication related options (especially
DefaultAuthInfo if you want authentication between MTAs).
@@ -752,7 +773,11 @@ GCC problems
We have been told there are problems with gcc 2.8.0. If you are
using this version, you should upgrade to 2.8.1 or later.
-GDBM GDBM does not work with sendmail 8.8 because the additional
+Berkeley DB
+ Berkeley DB 4.1.x with x <= 24 does not work with sendmail.
+ You need at least 4.1.25.
+
+GDBM GDBM does not work with sendmail because the additional
security checks and file locking cause problems. Unfortunately,
gdbm does not provide a compile flag in its version of ndbm.h so
the code can adapt. Until the GDBM authors can fix these problems,
@@ -990,7 +1015,7 @@ Solaris
Do not use:
- host: nisplus dns [NOTFOUND=return] files
+ hosts: nisplus dns [NOTFOUND=return] files
Note that 'nisplus' above is an illustration. The same comment
applies no matter what naming services you are using. If you have
@@ -1329,7 +1354,7 @@ AIX 4.X
/usr/lib and /lib. If you need to allow more directories, such as
/usr/local/lib, modify your devtools/Site/site.AIX.4.2.m4,
site.AIX.4.3.m4, and/or site.AIX.4.x.m4 file(s) and set confLDOPTS
- approriately. For example:
+ appropriately. For example:
define(`confLDOPTS', `-blibpath:/usr/lib:/lib:/usr/local/lib')
@@ -1481,7 +1506,7 @@ UNICOS 8.0.3.4
running sendmail. Reported by Jerry G. DeLapp <jgd@acl.lanl.gov>.
Darwin/Mac OS X (10.X.X)
- The linker errors produced regarding getopt() and it's associated
+ The linker errors produced regarding getopt() and its associated
variables can safely be ignored.
From Mike Zimmerman <zimmy@torrentnet.com>:
@@ -1596,7 +1621,7 @@ Listproc 6.0c
Just upgraded to sendmail 8.7, and discovered that listproc 6.0c
breaks, because it, by default, sends a blank "HELO" rather than
- a "HELO hostname" when using the 'system' or 'telnet' mailmethod.
+ a "HELO hostname" when using the 'system' or 'telnet' mail method.
The fix is to include -DZMAILER in the compilation, which will
cause it to use "HELO hostname" (which Z-mail apparently requires
@@ -1768,4 +1793,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.3 $, last update $Date: 2002/06/21 22:44:56 $ )
+(Version $Revision: 8.355.2.11 $, last update $Date: 2002/12/18 17:15:46 $ )
diff --git a/contrib/sendmail/src/SECURITY b/contrib/sendmail/src/SECURITY
index e42c024..71b4643 100644
--- a/contrib/sendmail/src/SECURITY
+++ b/contrib/sendmail/src/SECURITY
@@ -5,7 +5,7 @@
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
-# $Id: SECURITY,v 1.50 2002/03/29 19:45:48 ca Exp $
+# $Id: SECURITY,v 1.50.2.1 2002/09/23 21:28:48 ca Exp $
#
This file gives some hints how to configure and run sendmail for
@@ -199,4 +199,5 @@ Then you can use
sh ./Build install-set-user-id
to install the package in the old (pre-8.12) way. Make sure that
-no submit.cf file is installed.
+no submit.cf file is installed. See devtools/README about
+confSETUSERID_INSTALL which you need to define.
diff --git a/contrib/sendmail/src/TRACEFLAGS b/contrib/sendmail/src/TRACEFLAGS
index 2aad39b..6762d8d 100644
--- a/contrib/sendmail/src/TRACEFLAGS
+++ b/contrib/sendmail/src/TRACEFLAGS
@@ -1,4 +1,4 @@
-# $Id: TRACEFLAGS,v 8.37.2.1 2002/07/01 20:55:47 gshapiro Exp $
+# $Id: TRACEFLAGS,v 8.37.2.3 2002/09/12 02:57:36 gshapiro Exp $
0, 4 main.c main canonical name, UUCP node name, a.k.a.s
0, 15 main.c main print configuration
0, 44 util.c printav print address of each string
@@ -75,8 +75,12 @@
63 queue.c runqueue process watching
64 multiple Milter
65 main.c permission checks
+#if _FFR_ADAPTIVE_EOL
66 srvrsmtp.c conformance checks
+#endif /* _FFR_ADAPTIVE_EOL */
+#if _FFR_QUEUE_SCHED_DBG
69 queue.c scheduling
+#endif /* _FFR_QUEUE_SCHED_DBG */
#if _FFR_QUARANTINE
70 queue.c quarantining
#endif /* _FFR_QUARANTINE */
@@ -84,6 +88,7 @@
80 content length
81 sun remote mode
91 mci.c syslogging of MCI cache information
+93,>99 * Prevent daemon connection fork for profiling/debugging
94,>99 srvrsmtp.c cause commands to fail (for protocol testing)
95 srvrsmtp.c AUTH
95 usersmtp.c AUTH
diff --git a/contrib/sendmail/src/collect.c b/contrib/sendmail/src/collect.c
index a4149fb..6ebd049 100644
--- a/contrib/sendmail/src/collect.c
+++ b/contrib/sendmail/src/collect.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: collect.c,v 8.242.2.2 2002/08/16 14:56:01 ca Exp $")
+SM_RCSID("@(#)$Id: collect.c,v 8.242.2.3 2002/12/03 17:06:30 gshapiro Exp $")
static void collecttimeout __P((time_t));
static void dferror __P((SM_FILE_T *volatile, char *, ENVELOPE *));
@@ -350,6 +350,16 @@ collect(fp, smtpmode, hdrp, e)
"timeout waiting for input from %s during message collect",
CURHOSTNAME);
errno = 0;
+ if (smtpmode)
+ {
+ /*
+ ** Override e_message in usrerr() as this
+ ** is the reason for failure that should
+ ** be logged for undelivered recipients.
+ */
+
+ e->e_message = NULL;
+ }
usrerr("451 4.4.1 timeout waiting for input during message collect");
goto readerr;
}
diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c
index a850b2a..69e5c67 100644
--- a/contrib/sendmail/src/conf.c
+++ b/contrib/sendmail/src/conf.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: conf.c,v 8.972.2.5 2002/08/16 14:56:01 ca Exp $")
+SM_RCSID("@(#)$Id: conf.c,v 8.972.2.25 2002/12/12 21:19:29 ca Exp $")
#include <sendmail/pathnames.h>
@@ -28,7 +28,6 @@ SM_RCSID("@(#)$Id: conf.c,v 8.972.2.5 2002/08/16 14:56:01 ca Exp $")
# include <ulimit.h>
#endif /* HASULIMIT && defined(HPUX11) */
-
static void setupmaps __P((void));
static void setupmailers __P((void));
static void setupqueues __P((void));
@@ -364,6 +363,12 @@ setdefaults(e)
#if MILTER
InputFilters[0] = NULL;
#endif /* MILTER */
+#if _FFR_REJECT_LOG
+ RejectLogInterval = 3 HOURS;
+#endif /* _FFR_REJECT_LOG */
+#if _FFR_REQ_DIR_FSYNC_OPT
+ RequiresDirfsync = true;
+#endif /* _FFR_REQ_DIR_FSYNC_OPT */
setupmaps();
setupqueues();
setupmailers();
@@ -2170,6 +2175,10 @@ refuseconnections(name, e, d, active)
{
static time_t lastconn[MAXDAEMONS];
static int conncnt[MAXDAEMONS];
+#if _FFR_REJECT_LOG
+ static time_t firstrejtime[MAXDAEMONS];
+ static time_t nextlogtime[MAXDAEMONS];
+#endif /* _FFR_REJECT_LOG */
#if XLA
if (!xla_smtp_ok())
@@ -2207,12 +2216,35 @@ refuseconnections(name, e, d, active)
sm_getla();
if (RefuseLA > 0 && CurrentLA >= RefuseLA)
{
+# if _FFR_REJECT_LOG
+ time_t now;
+
+# define R2_MSG_LA "have been rejecting connections on daemon %s for %s"
+# endif /* _FFR_REJECT_LOG */
# define R_MSG_LA "rejecting connections on daemon %s: load average: %d"
sm_setproctitle(true, e, R_MSG_LA, name, CurrentLA);
if (LogLevel > 8)
- sm_syslog(LOG_INFO, NOQID, R_MSG_LA, name, CurrentLA);
+ sm_syslog(LOG_NOTICE, NOQID, R_MSG_LA, name, CurrentLA);
+#if _FFR_REJECT_LOG
+ now = curtime();
+ if (firstrejtime[d] == 0)
+ {
+ firstrejtime[d] = now;
+ nextlogtime[d] = now + RejectLogInterval;
+ }
+ else if (nextlogtime[d] < now)
+ {
+ sm_syslog(LOG_ERR, NOQID, R2_MSG_LA, name,
+ pintvl(now - firstrejtime[d], true));
+ nextlogtime[d] = now + RejectLogInterval;
+ }
+#endif /* _FFR_REJECT_LOG */
return true;
}
+#if _FFR_REJECT_LOG
+ else
+ firstrejtime[d] = 0;
+#endif /* _FFR_REJECT_LOG */
if (DelayLA > 0 && CurrentLA >= DelayLA)
{
@@ -3067,13 +3099,13 @@ static char *DefaultUserShells[] =
# ifdef sgi
"/sbin/sh", /* SGI's shells really live in /sbin */
"/usr/bin/sh",
- "/sbin/bsh", /* classic borne shell */
+ "/sbin/bsh", /* classic Bourne shell */
"/bin/bsh",
"/usr/bin/bsh",
"/sbin/csh", /* standard csh */
"/bin/csh",
"/usr/bin/csh",
- "/sbin/jsh", /* classic borne shell w/ job control*/
+ "/sbin/jsh", /* classic Bourne shell w/ job control*/
"/bin/jsh",
"/usr/bin/jsh",
"/bin/ksh", /* Korn shell */
@@ -3679,9 +3711,6 @@ chownsafe(fd, safedir)
# endif /* RLIMIT_NEEDS_SYS_TIME_H */
# include <sys/resource.h>
#endif /* HASSETRLIMIT */
-#ifndef FD_SETSIZE
-# define FD_SETSIZE 256
-#endif /* ! FD_SETSIZE */
void
resetlimits()
@@ -5885,6 +5914,9 @@ char *FFRCompileOptions[] =
#if _FFR_DAEMON_NETUNIX
"_FFR_DAEMON_NETUNIX",
#endif /* _FFR_DAEMON_NETUNIX */
+#if _FFR_DEAL_WITH_ERROR_SSL
+ "_FFR_DEAL_WITH_ERROR_SSL",
+#endif /* _FFR_DEAL_WITH_ERROR_SSL */
#if _FFR_DEPRECATE_MAILER_FLAG_I
"_FFR_DEPRECATE_MAILER_FLAG_I",
#endif /* _FFR_DEPRECATE_MAILER_FLAG_I */
@@ -5958,6 +5990,9 @@ char *FFRCompileOptions[] =
"_FFR_MAX_FORWARD_ENTRIES",
#endif /* _FFR_MAX_FORWARD_ENTRIES */
#if MILTER
+# if _FFR_MILTER_421
+ "_FFR_MILTER_421",
+# endif /* _FFR_MILTER_421 */
# if _FFR_MILTER_PERDAEMON
"_FFR_MILTER_PERDAEMON",
# endif /* _FFR_MILTER_PERDAEMON */
@@ -5966,10 +6001,6 @@ char *FFRCompileOptions[] =
/* Steven Pitzl */
"_FFR_NODELAYDSN_ON_HOLD",
#endif /* _FFR_NODELAYDSN_ON_HOLD */
-#if _FFR_NONSTOP_PERSISTENCE
-/* Suggested by Jan Krueger of digitalanswers communications consulting gmbh. */
- "_FFR_NONSTOP_PERSISTENCE",
-#endif /* _FFR_NONSTOP_PERSISTENCE */
#if _FFR_NO_PIPE
"_FFR_NO_PIPE",
#endif /* _FFR_NO_PIPE */
@@ -5995,6 +6026,12 @@ char *FFRCompileOptions[] =
#if _FFR_REDIRECTEMPTY
"_FFR_REDIRECTEMPTY",
#endif /* _FFR_REDIRECTEMPTY */
+#if _FFR_REJECT_LOG
+ "_FFR_REJECT_LOG",
+#endif /* _FFR_REJECT_LOG */
+#if _FFR_REQ_DIR_FSYNC_OPT
+ "_FFR_REQ_DIR_FSYNC_OPT",
+#endif /* _FFR_REQ_DIR_FSYNC_OPT */
#if _FFR_RESET_MACRO_GLOBALS
"_FFR_RESET_MACRO_GLOBALS",
#endif /* _FFR_RESET_MACRO_GLOBALS */
@@ -6027,6 +6064,9 @@ char *FFRCompileOptions[] =
/* Chris Adams of HiWAAY Informations Services */
"_FFR_SPT_ALIGN",
#endif /* _FFR_SPT_ALIGN */
+#if _FFR_STRIPBACKSL
+ "_FFR_STRIPBACKSL",
+#endif /* _FFR_STRIPBACKSL */
#if _FFR_TIMERS
"_FFR_TIMERS",
#endif /* _FFR_TIMERS */
diff --git a/contrib/sendmail/src/conf.h b/contrib/sendmail/src/conf.h
index 22d7737..0675c2d 100644
--- a/contrib/sendmail/src/conf.h
+++ b/contrib/sendmail/src/conf.h
@@ -10,7 +10,7 @@
* the sendmail distribution.
*
*
- * $Id: conf.h,v 8.563 2002/06/04 02:13:50 geir Exp $
+ * $Id: conf.h,v 8.563.2.3 2002/10/31 03:28:36 ca Exp $
*/
/*
@@ -61,6 +61,9 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */
#define MAXLINE 2048 /* max line length */
#define MAXNAME 256 /* max length of a name */
+#ifndef MAXAUTHINFO
+# define MAXAUTHINFO 100 /* max length of authinfo token */
+#endif /* ! MAXAUTHINFO */
#define MAXPV 256 /* max # of parms to mailers */
#define MAXATOM 1000 /* max atoms per address */
#define MAXRWSETS 200 /* max # of sets of rewriting rules */
diff --git a/contrib/sendmail/src/control.c b/contrib/sendmail/src/control.c
index 88ff72f..d36dc66 100644
--- a/contrib/sendmail/src/control.c
+++ b/contrib/sendmail/src/control.c
@@ -10,7 +10,9 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: control.c,v 8.118 2002/03/19 00:23:27 gshapiro Exp $")
+SM_RCSID("@(#)$Id: control.c,v 8.118.4.3 2002/11/14 00:15:56 ca Exp $")
+
+#include <sm/fdset.h>
/* values for cmd_code */
#define CMDERROR 0 /* bad command */
@@ -90,6 +92,12 @@ opencontrolsocket()
ControlSocket = socket(AF_UNIX, SOCK_STREAM, 0);
if (ControlSocket < 0)
return -1;
+ if (SM_FD_SETSIZE > 0 && ControlSocket >= SM_FD_SETSIZE)
+ {
+ clrcontrol();
+ errno = EINVAL;
+ return -1;
+ }
(void) unlink(ControlSocketName);
memset(&controladdr, '\0', sizeof controladdr);
diff --git a/contrib/sendmail/src/daemon.c b/contrib/sendmail/src/daemon.c
index 28e96ff..5f8f146 100644
--- a/contrib/sendmail/src/daemon.c
+++ b/contrib/sendmail/src/daemon.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: daemon.c,v 8.613 2002/06/05 21:26:35 gshapiro Exp $")
+SM_RCSID("@(#)$Id: daemon.c,v 8.613.2.11 2002/12/05 16:13:52 ca Exp $")
#if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__)
# define USE_SOCK_STREAM 1
@@ -627,36 +627,41 @@ getrequests(e)
(void) getfallbackmxrr(FallBackMX);
#endif /* NAMED_BIND */
-#if !PROFILING
- /*
- ** Create a pipe to keep the child from writing to the
- ** socket until after the parent has closed it. Otherwise
- ** the parent may hang if the child has closed it first.
- */
-
- if (pipe(pipefd) < 0)
+ if (tTd(93, 100))
+ {
+ /* don't fork, handle connection in this process */
+ pid = 0;
pipefd[0] = pipefd[1] = -1;
-
- (void) sm_blocksignal(SIGCHLD);
- pid = fork();
- if (pid < 0)
+ }
+ else
{
- syserr("daemon: cannot fork");
- if (pipefd[0] != -1)
+ /*
+ ** Create a pipe to keep the child from writing to
+ ** the socket until after the parent has closed
+ ** it. Otherwise the parent may hang if the child
+ ** has closed it first.
+ */
+
+ if (pipe(pipefd) < 0)
+ pipefd[0] = pipefd[1] = -1;
+
+ (void) sm_blocksignal(SIGCHLD);
+ pid = fork();
+ if (pid < 0)
{
- (void) close(pipefd[0]);
- (void) close(pipefd[1]);
+ syserr("daemon: cannot fork");
+ if (pipefd[0] != -1)
+ {
+ (void) close(pipefd[0]);
+ (void) close(pipefd[1]);
+ }
+ (void) sm_releasesignal(SIGCHLD);
+ (void) sleep(10);
+ (void) close(t);
+ continue;
}
- (void) sm_releasesignal(SIGCHLD);
- (void) sleep(10);
- (void) close(t);
- continue;
}
-#else /* !PROFILING */
- pid = 0;
-#endif /* !PROFILING */
-
if (pid == 0)
{
char *p;
@@ -736,7 +741,6 @@ getrequests(e)
anynet_ntoa(&RealHostAddr));
}
-#if !PROFILING
if (pipefd[0] != -1)
{
auto char c;
@@ -758,7 +762,6 @@ getrequests(e)
continue;
(void) close(pipefd[0]);
}
-#endif /* !PROFILING */
/* control socket processing */
if (control)
@@ -914,8 +917,8 @@ getrequests(e)
if (Daemons[curdaemon].d_inputfilterlist != NULL)
{
for (i = 0;
- (Daemons[curdaemon].d_inputfilters[i] != NULL &&
- i < MAXFILTERS);
+ (i < MAXFILTERS &&
+ Daemons[curdaemon].d_inputfilters[i] != NULL);
i++)
{
InputFilters[i] = Daemons[curdaemon].d_inputfilters[i];
@@ -1093,6 +1096,14 @@ opendaemonsocket(d, firsttime)
continue;
}
+ if (SM_FD_SETSIZE > 0 && d->d_socket >= SM_FD_SETSIZE)
+ {
+ save_errno = EINVAL;
+ syserr("opendaemonsocket: daemon %s: server SMTP socket (%d) too large",
+ d->d_name, d->d_socket);
+ goto fail;
+ }
+
/* turn on network debugging? */
if (tTd(15, 101))
(void) setsockopt(d->d_socket, SOL_SOCKET,
@@ -3289,7 +3300,7 @@ getauthinfo(fd, may_be_forged)
char *ostype = NULL;
char **ha;
char ibuf[MAXNAME + 1];
- static char hbuf[MAXNAME * 2 + 11];
+ static char hbuf[MAXNAME + MAXAUTHINFO + 11];
*may_be_forged = false;
falen = sizeof RealHostAddr;
@@ -3473,7 +3484,6 @@ getauthinfo(fd, may_be_forged)
/* put a timeout around the whole thing */
ev = sm_setevent(TimeOuts.to_ident, authtimeout, 0);
-
/* connect to foreign IDENT server using same address as SMTP socket */
s = socket(la.sa.sa_family, SOCK_STREAM, 0);
if (s < 0)
@@ -3567,10 +3577,10 @@ getauthinfo(fd, may_be_forged)
(ostype[5] == ' ' || ostype[5] == '\0'))
{
(void) sm_strlcpy(hbuf, "IDENT:", sizeof hbuf);
- cleanstrcpy(&hbuf[6], p, MAXNAME);
+ cleanstrcpy(&hbuf[6], p, MAXAUTHINFO);
}
else
- cleanstrcpy(hbuf, p, MAXNAME);
+ cleanstrcpy(hbuf, p, MAXAUTHINFO);
len = strlen(hbuf);
(void) sm_strlcpyn(&hbuf[len], sizeof hbuf - len, 2, "@",
RealHostName == NULL ? "localhost" : RealHostName);
diff --git a/contrib/sendmail/src/deliver.c b/contrib/sendmail/src/deliver.c
index 46f5a91..46b5ba6 100644
--- a/contrib/sendmail/src/deliver.c
+++ b/contrib/sendmail/src/deliver.c
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <sys/time.h>
-SM_RCSID("@(#)$Id: deliver.c,v 8.940.2.3 2002/08/16 14:56:01 ca Exp $")
+SM_RCSID("@(#)$Id: deliver.c,v 8.940.2.10 2002/12/12 22:46:34 ca Exp $")
#if HASSETUSERCONTEXT
# include <login_cap.h>
@@ -623,7 +623,6 @@ sendall(e, mode)
/* and save qid for reacquisition */
ee->e_id = qid;
}
-
#endif /* !HASFLOCK */
/*
@@ -954,6 +953,11 @@ sync_dir(filename, panic)
char *dirp;
char dir[MAXPATHLEN];
+#if _FFR_REQ_DIR_FSYNC_OPT
+ if (!RequiresDirfsync)
+ return;
+#endif /* _FFR_REQ_DIR_FSYNC_OPT */
+
/* filesystems which require the directory be synced */
dirp = strrchr(filename, '/');
if (dirp != NULL)
@@ -1620,6 +1624,16 @@ deliver(e, firstto)
stripquotes(user);
stripquotes(host);
}
+#if _FFR_STRIPBACKSL
+ /*
+ ** Strip one leading backslash if requesting and the
+ ** next character is alphanumerical (the latter can
+ ** probably relaxed a bit, see RFC2821).
+ */
+
+ if (bitnset(M_STRIPBACKSL, m->m_flags) && user[0] == '\\')
+ stripbackslash(user);
+#endif /* _FFR_STRIPBACKSL */
/* hack attack -- delivermail compatibility */
if (m == ProgMailer && *user == '|')
@@ -2352,15 +2366,20 @@ tryhost:
if (contextaddr != NULL)
{
+ int sucflags;
struct passwd *pwd;
if (contextaddr->q_ruser != NULL)
pwd = sm_getpwnam(contextaddr->q_ruser);
else
pwd = sm_getpwnam(contextaddr->q_user);
+ sucflags = LOGIN_SETRESOURCES|LOGIN_SETPRIORITY;
+#ifdef LOGIN_SETMAC
+ sucflags |= LOGIN_SETMAC;
+#endif /* LOGIN_SETMAC */
if (pwd != NULL &&
setusercontext(NULL, pwd, pwd->pw_uid,
- LOGIN_SETRESOURCES|LOGIN_SETPRIORITY) == -1 &&
+ sucflags) == -1 &&
suidwarn)
{
syserr("openmailer: setusercontext() failed");
@@ -5943,8 +5962,8 @@ initclttls(tls_ok)
return false;
if (clt_ctx != NULL)
return true; /* already done */
- tls_ok_clt = inittls(&clt_ctx, TLS_I_CLT, false, CltCERTfile,
- Cltkeyfile, CACERTpath, CACERTfile, DHParams);
+ tls_ok_clt = inittls(&clt_ctx, TLS_I_CLT, false, CltCertFile,
+ CltKeyFile, CACertPath, CACertFile, DHParams);
return tls_ok_clt;
}
@@ -6063,6 +6082,21 @@ ssl_retry:
tv.tv_usec = 0;
}
+ if (!timedout && FD_SETSIZE > 0 &&
+ (rfd >= FD_SETSIZE ||
+ (i == SSL_ERROR_WANT_WRITE && wfd >= FD_SETSIZE)))
+ {
+ if (LogLevel > 5)
+ {
+ sm_syslog(LOG_ERR, e->e_id,
+ "STARTTLS=client, error: fd %d/%d too large",
+ rfd, wfd);
+ if (LogLevel > 8)
+ tlslogerr("client");
+ }
+ errno = EINVAL;
+ goto tlsfail;
+ }
if (!timedout && i == SSL_ERROR_WANT_READ)
{
fd_set ssl_maskr, ssl_maskx;
@@ -6095,6 +6129,7 @@ ssl_retry:
if (LogLevel > 8)
tlslogerr("client");
}
+tlsfail:
SSL_free(clt_ssl);
clt_ssl = NULL;
return EX_SOFTWARE;
diff --git a/contrib/sendmail/src/envelope.c b/contrib/sendmail/src/envelope.c
index 27ad7cb..c29871f 100644
--- a/contrib/sendmail/src/envelope.c
+++ b/contrib/sendmail/src/envelope.c
@@ -13,7 +13,42 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: envelope.c,v 8.282 2002/05/10 15:41:11 ca Exp $")
+SM_RCSID("@(#)$Id: envelope.c,v 8.282.2.2 2002/12/04 15:44:08 ca Exp $")
+
+/*
+** CLRSESSENVELOPE -- clear session oriented data in an envelope
+**
+** Parameters:
+** e -- the envelope to clear.
+**
+** Returns:
+** none.
+*/
+
+void
+clrsessenvelope(e)
+ ENVELOPE *e;
+{
+#if SASL
+ macdefine(&e->e_macro, A_PERM, macid("{auth_type}"), "");
+ macdefine(&e->e_macro, A_PERM, macid("{auth_authen}"), "");
+ macdefine(&e->e_macro, A_PERM, macid("{auth_author}"), "");
+ macdefine(&e->e_macro, A_PERM, macid("{auth_ssf}"), "");
+#endif /* SASL */
+#if STARTTLS
+ macdefine(&e->e_macro, A_PERM, macid("{cert_issuer}"), "");
+ macdefine(&e->e_macro, A_PERM, macid("{cert_subject}"), "");
+ macdefine(&e->e_macro, A_PERM, macid("{cipher_bits}"), "");
+ macdefine(&e->e_macro, A_PERM, macid("{cipher}"), "");
+ macdefine(&e->e_macro, A_PERM, macid("{tls_version}"), "");
+ macdefine(&e->e_macro, A_PERM, macid("{verify}"), "");
+# if _FFR_TLS_1
+ macdefine(&e->e_macro, A_PERM, macid("{alg_bits}"), "");
+ macdefine(&e->e_macro, A_PERM, macid("{cn_issuer}"), "");
+ macdefine(&e->e_macro, A_PERM, macid("{cn_subject}"), "");
+# endif /* _FFR_TLS_1 */
+#endif /* STARTTLS */
+}
/*
** NEWENVELOPE -- fill in a new envelope
@@ -923,6 +958,9 @@ setsender(from, e, delimptr, delimchar, internal)
if (tTd(45, 1))
sm_dprintf("setsender(%s)\n", from == NULL ? "" : from);
+ /* may be set from earlier calls */
+ macdefine(&e->e_macro, A_PERM, 'x', "");
+
/*
** Figure out the real user executing us.
** Username can return errno != 0 on non-errors.
@@ -1077,7 +1115,7 @@ setsender(from, e, delimptr, delimchar, internal)
e->e_from.q_home = NULL;
}
if (FullName != NULL && !internal)
- macdefine(&e->e_macro, A_PERM, 'x', FullName);
+ macdefine(&e->e_macro, A_TEMP, 'x', FullName);
}
else if (!internal && OpMode != MD_DAEMON && OpMode != MD_SMTP)
{
diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c
index fdcccf6..5d90344 100644
--- a/contrib/sendmail/src/headers.c
+++ b/contrib/sendmail/src/headers.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: headers.c,v 8.266.4.1 2002/08/16 14:56:01 ca Exp $")
+SM_RCSID("@(#)$Id: headers.c,v 8.266.4.2 2002/09/23 23:42:02 ca Exp $")
static size_t fix_mime_header __P((char *));
static int priencode __P((char *));
@@ -928,7 +928,7 @@ logsender(e, msgid)
", daemon=%.20s", p);
sbp += strlen(sbp);
}
- sm_syslog(LOG_INFO, e->e_id, "%.850s, relay=%.100s", sbuf, name);
+ sm_syslog(LOG_INFO, e->e_id, "%.850s, relay=%s", sbuf, name);
#else /* (SYSLOG_BUFSIZE) >= 256 */
@@ -960,7 +960,7 @@ logsender(e, msgid)
sbp += strlen(sbp);
}
sm_syslog(LOG_INFO, e->e_id,
- "%.400srelay=%.100s", sbuf, name);
+ "%.400srelay=%s", sbuf, name);
#endif /* (SYSLOG_BUFSIZE) >= 256 */
}
/*
diff --git a/contrib/sendmail/src/mailq.1 b/contrib/sendmail/src/mailq.1
index 0fae3ad..1eb234e 100644
--- a/contrib/sendmail/src/mailq.1
+++ b/contrib/sendmail/src/mailq.1
@@ -9,15 +9,16 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: mailq.1,v 8.19 2002/04/12 05:07:58 gshapiro Exp $
+.\" $Id: mailq.1,v 8.19.2.1 2002/09/26 23:03:39 gshapiro Exp $
.\"
-.TH MAILQ 1 "$Date: 2002/04/12 05:07:58 $"
+.TH MAILQ 1 "$Date: 2002/09/26 23:03:39 $"
.SH NAME
mailq
\- print the mail queue
.SH SYNOPSIS
.B mailq
.RB [ \-Ac ]
+.RB [ \-q... ]
.RB [ \-v ]
.SH DESCRIPTION
.B Mailq
@@ -54,6 +55,27 @@ Show the mail submission queue specified in
instead of the MTA queue specified in
.IR /etc/mail/sendmail.cf .
.TP
+\fB\-q\fR[\fI!\fR]I substr
+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
+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
+Limit processed jobs to those containing
+.I substr
+as a substring of the sender or not when
+.I !
+is specified.
+.TP
.B \-v
Print verbose information.
This adds the priority of the message and
diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c
index 2aff085..fd981fc9 100644
--- a/contrib/sendmail/src/main.c
+++ b/contrib/sendmail/src/main.c
@@ -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.1 2002/08/04 17:36:06 gshapiro Exp $")
+SM_RCSID("@(#)$Id: main.c,v 8.887.2.12 2002/12/05 17:38:44 ca Exp $")
#if NETINET || NETINET6
@@ -213,6 +213,10 @@ main(argc, argv, envp)
/* install default exception handler */
sm_exc_newthread(fatal_error);
+ /* set the default in/out channel so errors reported to screen */
+ InChannel = smioin;
+ OutChannel = smioout;
+
/*
** Check to see if we reentered.
** This would normally happen if e_putheader or e_putbody
@@ -609,9 +613,6 @@ main(argc, argv, envp)
sm_printoptions(FFRCompileOptions);
}
- InChannel = smioin;
- OutChannel = smioout;
-
/* clear sendmail's environment */
ExternalEnviron = environ;
emptyenviron[0] = NULL;
@@ -845,7 +846,10 @@ main(argc, argv, envp)
ExitStat = EX_USAGE;
break;
}
- from = newstr(denlstring(optarg, true, true));
+ if (optarg[0] == '\0')
+ from = newstr("<>");
+ else
+ from = newstr(denlstring(optarg, true, true));
if (strcmp(RealUserName, from) != 0)
warn_f_flag = j;
break;
@@ -1390,10 +1394,13 @@ main(argc, argv, envp)
if (tTd(0, 10))
{
+ char pidpath[MAXPATHLEN];
+
/* Now we know which .cf file we use */
sm_dprintf(" Conf file:\t%s (selected)\n",
getcfname(OpMode, SubmitMode, cftype, conffile));
- sm_dprintf(" Pid file:\t%s (selected)\n", PidFile);
+ expand(PidFile, pidpath, sizeof pidpath, &BlankEnvelope);
+ sm_dprintf(" Pid file:\t%s (selected)\n", pidpath);
}
if (tTd(0, 1))
@@ -2184,6 +2191,8 @@ main(argc, argv, envp)
CurrentPid = getpid();
if (qgrp != NOQGRP)
{
+ int rwgflags = RWG_NONE;
+
/*
** To run a specific queue group mark it to
** be run, select the work group it's in and
@@ -2194,9 +2203,13 @@ main(argc, argv, envp)
i++)
Queue[i]->qg_nextrun = (time_t) -1;
Queue[qgrp]->qg_nextrun = 0;
+ if (Verbose)
+ rwgflags |= RWG_VERBOSE;
+ if (queuepersistent)
+ rwgflags |= RWG_PERSISTENT;
+ rwgflags |= RWG_FORCE;
(void) run_work_group(Queue[qgrp]->qg_wgrp,
- false, Verbose,
- queuepersistent, false);
+ rwgflags);
}
else
(void) runqueue(false, Verbose,
@@ -2440,9 +2453,8 @@ main(argc, argv, envp)
/* init TLS for server, ignore result for now */
(void) initsrvtls(tls_ok);
#endif /* STARTTLS */
-#if PROFILING
+
nextreq:
-#endif /* PROFILING */
p_flags = getrequests(&MainEnvelope);
/* drop privileges */
@@ -2466,7 +2478,7 @@ main(argc, argv, envp)
if (LogLevel > 9)
{
/* log connection information */
- sm_syslog(LOG_INFO, NULL, "connect from %.100s", authinfo);
+ sm_syslog(LOG_INFO, NULL, "connect from %s", authinfo);
}
/*
@@ -2541,12 +2553,14 @@ main(argc, argv, envp)
/* turn off profiling */
SM_PROF(1);
smtp(nullserver, *p_flags, &MainEnvelope);
-#if PROFILING
- /* turn off profiling */
- SM_PROF(0);
- if (OpMode == MD_DAEMON)
- goto nextreq;
-#endif /* PROFILING */
+
+ if (tTd(93, 100))
+ {
+ /* turn off profiling */
+ SM_PROF(0);
+ if (OpMode == MD_DAEMON)
+ goto nextreq;
+ }
}
sm_rpool_free(MainEnvelope.e_rpool);
@@ -4086,7 +4100,7 @@ testmodeline(line, e)
"Name too long\n");
return;
}
- (void) getcanonname(host, sizeof host, HasWildcardMX,
+ (void) getcanonname(host, sizeof host, !HasWildcardMX,
NULL);
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
"getcanonname(%s) returns %s\n",
diff --git a/contrib/sendmail/src/map.c b/contrib/sendmail/src/map.c
index feba80b..6f9a461 100644
--- a/contrib/sendmail/src/map.c
+++ b/contrib/sendmail/src/map.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: map.c,v 8.645.2.3 2002/08/09 22:23:13 gshapiro Exp $")
+SM_RCSID("@(#)$Id: map.c,v 8.645.2.7 2002/12/03 17:01:15 ca Exp $")
#if LDAPMAP
# include <sm/ldap.h>
@@ -29,10 +29,7 @@ SM_RCSID("@(#)$Id: map.c,v 8.645.2.3 2002/08/09 22:23:13 gshapiro Exp $")
# endif /* R_FIRST */
#endif /* NDBM */
#if NEWDB
-# include <db.h>
-# ifndef DB_VERSION_MAJOR
-# define DB_VERSION_MAJOR 1
-# endif /* ! DB_VERSION_MAJOR */
+# include "sm/bdb.h"
#endif /* NEWDB */
#if NIS
struct dom_binding; /* forward reference needed on IRIX */
@@ -2084,10 +2081,7 @@ db_map_open(map, mode, mapclassname, dbtype, openinfo)
flags |= DB_CREATE;
if (bitset(O_TRUNC, omode))
flags |= DB_TRUNCATE;
-
-# if !HASFLOCK && defined(DB_FCNTL_LOCKING)
- flags |= DB_FCNTL_LOCKING;
-# endif /* !HASFLOCK && defined(DB_FCNTL_LOCKING) */
+ SM_DB_FLAG_ADD(flags);
# if DB_VERSION_MAJOR > 2
ret = db_create(&db, NULL, 0);
@@ -2115,7 +2109,9 @@ db_map_open(map, mode, mapclassname, dbtype, openinfo)
# endif /* DB_HASH_NELEM */
if (ret == 0 && db != NULL)
{
- ret = db->open(db, buf, NULL, dbtype, flags, DBMMODE);
+ ret = db->open(db,
+ DBTXN /* transaction for DB 4.1 */
+ buf, NULL, dbtype, flags, DBMMODE);
if (ret != 0)
{
#ifdef DB_OLD_VERSION
@@ -4888,11 +4884,25 @@ ldapmap_set_defaults(spec)
*/
/* what version of the ph map code we're running */
-static char phmap_id[PH_BUF_SIZE];
+static char phmap_id[128];
/* sendmail version for phmap id string */
extern const char Version[];
+/* assume we're using nph-1.1.x if not specified */
+# ifndef NPH_VERSION
+# define NPH_VERSION 10100
+# endif
+
+/* compatibility for versions older than nph-1.2.0 */
+# if NPH_VERSION < 10200
+# define PH_OPEN_ROUNDROBIN PH_ROUNDROBIN
+# define PH_OPEN_DONTID PH_DONTID
+# define PH_CLOSE_FAST PH_FASTCLOSE
+# define PH_ERR_DATAERR PH_DATAERR
+# define PH_ERR_NOMATCH PH_NOMATCH
+# endif /* NPH_VERSION < 10200 */
+
/*
** PH_MAP_PARSEARGS -- parse ph map definition args.
*/
@@ -5090,7 +5100,12 @@ ph_timeout(unused)
}
static void
+#if NPH_VERSION >= 10200
+ph_map_send_debug(appdata, text)
+ void *appdata;
+#else
ph_map_send_debug(text)
+#endif
char *text;
{
if (LogLevel > 9)
@@ -5101,7 +5116,12 @@ ph_map_send_debug(text)
}
static void
+#if NPH_VERSION >= 10200
+ph_map_recv_debug(appdata, text)
+ void *appdata;
+#else
ph_map_recv_debug(text)
+#endif
char *text;
{
if (LogLevel > 10)
@@ -5178,9 +5198,14 @@ ph_map_open(map, mode)
}
/* open connection to server */
- if (!ph_open(&(pmap->ph), host, PH_ROUNDROBIN|PH_DONTID,
- ph_map_send_debug, ph_map_recv_debug) &&
- !ph_id(pmap->ph, phmap_id))
+ if (ph_open(&(pmap->ph), host,
+ PH_OPEN_ROUNDROBIN|PH_OPEN_DONTID,
+ ph_map_send_debug, ph_map_recv_debug
+#if NPH_VERSION >= 10200
+ , NULL
+#endif
+ ) == 0
+ && ph_id(pmap->ph, phmap_id) == 0)
{
if (ev != NULL)
sm_clrevent(ev);
@@ -5192,7 +5217,7 @@ ph_map_open(map, mode)
save_errno = errno;
if (ev != NULL)
sm_clrevent(ev);
- pmap->ph_fastclose = PH_FASTCLOSE;
+ pmap->ph_fastclose = PH_CLOSE_FAST;
ph_map_close(map);
errno = save_errno;
}
@@ -5253,7 +5278,7 @@ ph_map_lookup(map, key, args, pstat)
i = ph_email_resolve(pmap->ph, key, pmap->ph_field_list, &value);
if (i == -1)
*pstat = EX_TEMPFAIL;
- else if (i == PH_NOMATCH || i == PH_DATAERR)
+ else if (i == PH_ERR_NOMATCH || i == PH_ERR_DATAERR)
*pstat = EX_UNAVAILABLE;
ph_map_lookup_abort:
@@ -5268,7 +5293,7 @@ ph_map_lookup(map, key, args, pstat)
if (*pstat == EX_TEMPFAIL)
{
save_errno = errno;
- pmap->ph_fastclose = PH_FASTCLOSE;
+ pmap->ph_fastclose = PH_CLOSE_FAST;
ph_map_close(map);
errno = save_errno;
}
diff --git a/contrib/sendmail/src/mci.c b/contrib/sendmail/src/mci.c
index b54b13d..5172333 100644
--- a/contrib/sendmail/src/mci.c
+++ b/contrib/sendmail/src/mci.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: mci.c,v 8.205 2002/05/24 18:53:48 gshapiro Exp $")
+SM_RCSID("@(#)$Id: mci.c,v 8.205.2.2 2002/11/26 19:15:19 gshapiro Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -1244,8 +1244,10 @@ 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 271f7dc..585981c 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.2 2002/08/06 22:58:38 gshapiro Exp $")
+SM_RCSID("@(#)$Id: milter.c,v 8.197.2.5 2002/11/11 23:22:28 ca Exp $")
#if MILTER
# include <libmilter/mfapi.h>
@@ -580,7 +580,7 @@ milter_open(m, parseonly, e)
if (parseonly)
syserr("X%s: empty or missing socket information",
m->mf_name);
- else if (MilterLogLevel > 10)
+ else if (MilterLogLevel > 0)
sm_syslog(LOG_ERR, e->e_id,
"Milter (%s): empty or missing socket information",
m->mf_name);
@@ -611,9 +611,10 @@ milter_open(m, parseonly, e)
addr.sa.sa_family = AF_INET6;
# else /* NETINET6 */
/* no protocols available */
- sm_syslog(LOG_ERR, e->e_id,
- "Milter (%s): no valid socket protocols available",
- m->mf_name);
+ if (MilterLogLevel > 0)
+ sm_syslog(LOG_ERR, e->e_id,
+ "Milter (%s): no valid socket protocols available",
+ m->mf_name);
milter_error(m, e);
return -1;
# endif /* NETINET6 */
@@ -646,7 +647,7 @@ milter_open(m, parseonly, e)
if (parseonly)
syserr("X%s: unknown socket type %s",
m->mf_name, p);
- else if (MilterLogLevel > 10)
+ else if (MilterLogLevel > 0)
sm_syslog(LOG_ERR, e->e_id,
"Milter (%s): unknown socket type %s",
m->mf_name, p);
@@ -677,7 +678,7 @@ milter_open(m, parseonly, e)
if (parseonly)
syserr("X%s: local socket name %s too long",
m->mf_name, colon);
- else if (MilterLogLevel > 10)
+ else if (MilterLogLevel > 0)
sm_syslog(LOG_ERR, e->e_id,
"Milter (%s): local socket name %s too long",
m->mf_name, colon);
@@ -712,7 +713,7 @@ milter_open(m, parseonly, e)
syserr("X%s: local socket name %s unsafe",
m->mf_name, colon);
}
- else if (MilterLogLevel > 10)
+ else if (MilterLogLevel > 0)
sm_syslog(LOG_ERR, e->e_id,
"Milter (%s): local socket name %s unsafe",
m->mf_name, colon);
@@ -748,7 +749,7 @@ milter_open(m, parseonly, e)
if (parseonly)
syserr("X%s: bad address %s (expected port@host)",
m->mf_name, colon);
- else if (MilterLogLevel > 10)
+ else if (MilterLogLevel > 0)
sm_syslog(LOG_ERR, e->e_id,
"Milter (%s): bad address %s (expected port@host)",
m->mf_name, colon);
@@ -767,7 +768,7 @@ milter_open(m, parseonly, e)
if (parseonly)
syserr("X%s: invalid port number %s",
m->mf_name, colon);
- else if (MilterLogLevel > 10)
+ else if (MilterLogLevel > 0)
sm_syslog(LOG_ERR, e->e_id,
"Milter (%s): invalid port number %s",
m->mf_name, colon);
@@ -787,7 +788,7 @@ milter_open(m, parseonly, e)
if (parseonly)
syserr("X%s: unknown port name %s",
m->mf_name, colon);
- else if (MilterLogLevel > 10)
+ else if (MilterLogLevel > 0)
sm_syslog(LOG_ERR, e->e_id,
"Milter (%s): unknown port name %s",
m->mf_name, colon);
@@ -843,7 +844,7 @@ milter_open(m, parseonly, e)
if (parseonly)
syserr("X%s: Invalid numeric domain spec \"%s\"",
m->mf_name, at);
- else if (MilterLogLevel > 10)
+ else if (MilterLogLevel > 0)
sm_syslog(LOG_ERR, e->e_id,
"Milter (%s): Invalid numeric domain spec \"%s\"",
m->mf_name, at);
@@ -859,7 +860,7 @@ milter_open(m, parseonly, e)
if (parseonly)
syserr("X%s: Invalid numeric domain spec \"%s\"",
m->mf_name, at);
- else if (MilterLogLevel > 10)
+ else if (MilterLogLevel > 0)
sm_syslog(LOG_ERR, e->e_id,
"Milter (%s): Invalid numeric domain spec \"%s\"",
m->mf_name, at);
@@ -880,7 +881,7 @@ milter_open(m, parseonly, e)
if (parseonly)
syserr("X%s: Unknown host name %s",
m->mf_name, at);
- else if (MilterLogLevel > 10)
+ else if (MilterLogLevel > 0)
sm_syslog(LOG_ERR, e->e_id,
"Milter (%s): Unknown host name %s",
m->mf_name, at);
@@ -918,7 +919,7 @@ milter_open(m, parseonly, e)
if (parseonly)
syserr("X%s: Unknown protocol for %s (%d)",
m->mf_name, at, hp->h_addrtype);
- else if (MilterLogLevel > 10)
+ else if (MilterLogLevel > 0)
sm_syslog(LOG_ERR, e->e_id,
"Milter (%s): Unknown protocol for %s (%d)",
m->mf_name, at,
@@ -939,7 +940,7 @@ milter_open(m, parseonly, e)
m->mf_name);
if (parseonly)
syserr("X%s: unknown socket protocol", m->mf_name);
- else if (MilterLogLevel > 10)
+ else if (MilterLogLevel > 0)
sm_syslog(LOG_ERR, e->e_id,
"Milter (%s): unknown socket protocol",
m->mf_name);
@@ -3226,7 +3227,14 @@ milter_connect(hostname, addr, e, state)
{
if (response != NULL &&
*response == '4')
- *state = SMFIR_TEMPFAIL;
+ {
+#if _FFR_MILTER_421
+ if (strncmp(response, "421 ", 4) == 0)
+ *state = SMFIR_SHUTDOWN;
+ else
+#endif /* _FFR_MILTER_421 */
+ *state = SMFIR_TEMPFAIL;
+ }
else
*state = SMFIR_REJECT;
if (response != NULL)
@@ -3724,7 +3732,7 @@ milter_data(e, state)
case SMFIR_REPLBODY:
if (!bitset(SMFIF_MODBODY, m->mf_fflags))
{
- if (MilterLogLevel > 0)
+ if (MilterLogLevel > 9)
sm_syslog(LOG_ERR, e->e_id,
"milter_data(%s): lied about replacing body, rejecting request and tempfailing message",
m->mf_name);
diff --git a/contrib/sendmail/src/parseaddr.c b/contrib/sendmail/src/parseaddr.c
index c7de84b..a69554a 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.359.2.2 2002/08/16 14:56:01 ca Exp $")
+SM_RCSID("@(#)$Id: parseaddr.c,v 8.359.2.3 2002/09/26 23:03:39 gshapiro Exp $")
static void allocaddr __P((ADDRESS *, int, char *, ENVELOPE *));
static int callsubr __P((char**, int, ENVELOPE *));
@@ -2086,6 +2086,7 @@ badaddr:
}
return a;
}
+
/*
** CATADDR -- concatenate pieces of addresses (putting in <LWSP> subs)
**
diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c
index 26e73f0..a0ce797 100644
--- a/contrib/sendmail/src/queue.c
+++ b/contrib/sendmail/src/queue.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: queue.c,v 8.863.2.6 2002/08/16 16:27:37 gshapiro Exp $")
+SM_RCSID("@(#)$Id: queue.c,v 8.863.2.22 2002/12/19 18:00:39 ca Exp $")
#include <dirent.h>
@@ -27,8 +27,10 @@ SM_RCSID("@(#)$Id: queue.c,v 8.863.2.6 2002/08/16 16:27:37 gshapiro Exp $")
/*
** Historical notes:
-** QF_VERSION==4 was sendmail 8.10/8.11 without _FFR_QUEUEDELAY
-** QF_VERSION==5 was sendmail 8.10/8.11 with _FFR_QUEUEDELAY
+** QF_VERSION == 4 was sendmail 8.10/8.11 without _FFR_QUEUEDELAY
+** QF_VERSION == 5 was sendmail 8.10/8.11 with _FFR_QUEUEDELAY
+** QF_VERSION == 6 is sendmail 8.12 without _FFR_QUEUEDELAY
+** QF_VERSION == 7 is sendmail 8.12 with _FFR_QUEUEDELAY
*/
#if _FFR_QUEUEDELAY
@@ -134,6 +136,7 @@ static int workcmpf1();
static int workcmpf2();
static int workcmpf3();
static int workcmpf4();
+static int randi = 3; /* index for workcmpf5() */
static int workcmpf5();
static int workcmpf6();
#if _FFR_RHS
@@ -198,6 +201,7 @@ static void *Pshm; /* pointer to shared memory */
static FILESYS *PtrFileSys; /* pointer to queue file system array */
int ShmId = SM_SHM_NO_ID; /* shared memory id */
static QUEUE_SHM_T *QShm; /* pointer to shared queue data */
+static size_t shms;
# define SHM_OFF_PID(p) (((char *) (p)) + sizeof(int))
# define SHM_OFF_TAG(p) (((char *) (p)) + sizeof(pid_t) + sizeof(int))
@@ -255,6 +259,7 @@ hash_q(p, h)
return h;
}
+
#else /* SM_CONF_SHM */
# define FILE_SYS(i) FileSys[i]
#endif /* SM_CONF_SHM */
@@ -265,6 +270,7 @@ hash_q(p, h)
#define FILE_SYS_BLKSIZE(i) FILE_SYS(i).fs_blksize
#define FILE_SYS_DEV(i) FILE_SYS(i).fs_dev
+
/*
** Current qf file field assignments:
**
@@ -1200,7 +1206,7 @@ restart_work_group(wgrp)
{
/* avoid overflow; increment here */
WorkGrp[wgrp].wg_restartcnt++;
- (void) run_work_group(wgrp, true, false, true, true);
+ (void) run_work_group(wgrp, RWG_FORK|RWG_PERSISTENT|RWG_RUNALL);
}
else
{
@@ -1438,6 +1444,8 @@ runqueue(forkflag, verbose, persistent, runall)
for (i = 0; i < NumWorkGroups && !NoMoreRunners; i++)
{
+ int rwgflags = RWG_NONE;
+
/*
** If MaxQueueChildren active then test whether the start
** of the next queue group's additional queue runners (maximum)
@@ -1477,8 +1485,15 @@ runqueue(forkflag, verbose, persistent, runall)
*/
CurRunners += WorkGrp[curnum].wg_maxact;
- ret = run_work_group(curnum, forkflag, verbose, persistent,
- runall);
+ if (forkflag)
+ rwgflags |= RWG_FORK;
+ if (verbose)
+ rwgflags |= RWG_VERBOSE;
+ if (persistent)
+ rwgflags |= RWG_PERSISTENT;
+ if (runall)
+ rwgflags |= RWG_RUNALL;
+ ret = run_work_group(curnum, rwgflags);
/*
** Failure means a message was printed for ETRN
@@ -1676,7 +1691,7 @@ runner_work(e, sequenceno, didfork, skip, njobs)
w->w_name + 2);
(void) dowork(w->w_qgrp, w->w_qdir, w->w_name + 2,
- false, false, e);
+ ForkQueueRuns , false, e);
errno = 0;
}
sm_free(w->w_name); /* XXX */
@@ -1711,12 +1726,7 @@ runner_work(e, sequenceno, didfork, skip, njobs)
**
** Parameters:
** wgrp -- work group to process.
-** forkflag -- true if the queue scanning should be done in
-** a child process. We double-fork so it is not our
-** child and we don't have to clean up after it.
-** verbose -- if true, print out status information.
-** persistent -- persistent queue runner?
-** runall -- true: run all of the queue groups in this work group
+** flags -- RWG_* flags
**
** Returns:
** true if the queue run successfully began.
@@ -1729,12 +1739,9 @@ runner_work(e, sequenceno, didfork, skip, njobs)
#define MIN_SLEEP_TIME 5
bool
-run_work_group(wgrp, forkflag, verbose, persistent, runall)
+run_work_group(wgrp, flags)
int wgrp;
- bool forkflag;
- bool verbose;
- bool persistent;
- bool runall;
+ int flags;
{
register ENVELOPE *e;
int njobs, qdir;
@@ -1758,11 +1765,12 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)
sm_getla(); /* get load average */
current_la_time = curtime();
- if (!persistent && shouldqueue(WkRecipFact, current_la_time))
+ if (!bitset(RWG_PERSISTENT, flags) &&
+ shouldqueue(WkRecipFact, current_la_time))
{
char *msg = "Skipping queue run -- load average too high";
- if (verbose)
+ if (bitset(RWG_VERBOSE, flags))
message("458 %s\n", msg);
if (LogLevel > 8)
sm_syslog(LOG_INFO, NOQID, "runqueue: %s", msg);
@@ -1773,12 +1781,14 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)
** See if we already have too many children.
*/
- if (forkflag && WorkGrp[wgrp].wg_lowqintvl > 0 && !persistent &&
+ if (bitset(RWG_FORK, flags) &&
+ WorkGrp[wgrp].wg_lowqintvl > 0 &&
+ !bitset(RWG_PERSISTENT, flags) &&
MaxChildren > 0 && CurChildren >= MaxChildren)
{
char *msg = "Skipping queue run -- too many children";
- if (verbose)
+ if (bitset(RWG_VERBOSE, flags))
message("458 %s (%d)\n", msg, CurChildren);
if (LogLevel > 8)
sm_syslog(LOG_INFO, NOQID, "runqueue: %s (%d)",
@@ -1790,7 +1800,7 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)
** See if we want to go off and do other useful work.
*/
- if (forkflag)
+ if (bitset(RWG_FORK, flags))
{
pid_t pid;
@@ -1803,7 +1813,7 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)
const char *msg = "Skipping queue run -- fork() failed";
const char *err = sm_errstring(errno);
- if (verbose)
+ if (bitset(RWG_VERBOSE, flags))
message("458 %s: %s\n", msg, err);
if (LogLevel > 8)
sm_syslog(LOG_INFO, NOQID, "runqueue: %s: %s",
@@ -1819,7 +1829,7 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)
/* wgrp only used when queue runners are persistent */
proc_list_add(pid, "Queue runner", PROC_QUEUE,
WorkGrp[wgrp].wg_maxact,
- persistent ? wgrp : -1);
+ bitset(RWG_PERSISTENT, flags) ? wgrp : -1);
(void) sm_releasesignal(SIGALRM);
(void) sm_releasesignal(SIGCHLD);
return true;
@@ -1876,7 +1886,7 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)
e->e_parent = NULL;
/* make sure we have disconnected from parent */
- if (forkflag)
+ if (bitset(RWG_FORK, flags))
{
disconnect(1, e);
QuickAbort = false;
@@ -1908,7 +1918,7 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)
/*
** Run a queue group if:
- ** runall is set or the bit for this group is set.
+ ** RWG_RUNALL bit is set or the bit for this group is set.
*/
now = curtime();
@@ -1922,14 +1932,14 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)
qgrp = WorkGrp[wgrp].wg_qgs[WorkGrp[wgrp].wg_curqgrp]->qg_index;
WorkGrp[wgrp].wg_curqgrp++; /* advance */
WorkGrp[wgrp].wg_curqgrp %= WorkGrp[wgrp].wg_numqgrp; /* wrap */
- if (runall ||
+ if (bitset(RWG_RUNALL, flags) ||
(Queue[qgrp]->qg_nextrun <= now &&
Queue[qgrp]->qg_nextrun != (time_t) -1))
break;
if (endgrp == WorkGrp[wgrp].wg_curqgrp)
{
e->e_id = NULL;
- if (forkflag)
+ if (bitset(RWG_FORK, flags))
finis(true, true, ExitStat);
return true; /* we're done */
}
@@ -1958,7 +1968,7 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)
sm_syslog(LOG_DEBUG, NOQID,
"runqueue %s, pid=%d, forkflag=%d",
qid_printqueue(qgrp, qdir), (int) CurrentPid,
- forkflag);
+ bitset(RWG_FORK, flags));
/*
** Start making passes through the queue.
@@ -2015,24 +2025,6 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)
maxrunners = njobs;
for (loop = 0; loop < maxrunners; loop++)
{
-#if _FFR_NONSTOP_PERSISTENCE
- /*
- ** Require a free "slot" before processing
- ** this queue runner.
- */
-
- while (MaxQueueChildren > 0 &&
- CurChildren > MaxQueueChildren)
- {
- int status;
- pid_t ret;
-
- while ((ret = sm_wait(&status)) <= 0)
- continue;
- proc_list_drop(ret, status, NULL);
- }
-#endif /* _FFR_NONSTOP_PERSISTENCE */
-
/*
** Since the delivery may happen in a child and the
** parent does not wait, the parent may close the
@@ -2116,7 +2108,6 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)
sm_releasesignal(SIGCHLD);
-#if !_FFR_NONSTOP_PERSISTENCE
/*
** Wait until all of the runners have completed before
** seeing if there is another queue group in the
@@ -2135,9 +2126,8 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)
continue;
proc_list_drop(ret, status, NULL);
}
-#endif /* !_FFR_NONSTOP_PERSISTENCE */
}
- else
+ else if (Queue[qgrp]->qg_maxqrun > 0 || bitset(RWG_FORCE, flags))
{
/*
** When current process will not fork children to do the work,
@@ -2162,7 +2152,7 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)
}
/* No more queues in work group to process. Now check persistent. */
- if (persistent)
+ if (bitset(RWG_PERSISTENT, flags))
{
sequenceno = 1;
sm_setproctitle(true, CurEnv, "running queue: %s",
@@ -2244,7 +2234,7 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)
/* exit without the usual cleanup */
e->e_id = NULL;
- if (forkflag)
+ if (bitset(RWG_FORK, flags))
finis(true, true, ExitStat);
/* NOTREACHED */
return true;
@@ -2918,12 +2908,14 @@ sortq(max)
else if (QueueSortOrder == QSO_RANDOM)
{
/*
- ** Sort randomly.
- ** workcmpf5() returns a random 1 or -1.
- ** As long as nobody does a verification pass over the
- ** sorted list, we should be golden.
+ ** Sort randomly. To avoid problems with an instable sort,
+ ** use a random index into the queue file name to start
+ ** comparison.
*/
+ randi = get_rand_mod(MAXQFNAME);
+ if (randi < 2)
+ randi = 3;
qsort((char *) WorkList, wc, sizeof *WorkList, workcmpf5);
}
else if (QueueSortOrder == QSO_BYMODTIME)
@@ -3226,7 +3218,9 @@ workcmpf5(a, b)
register WORK *a;
register WORK *b;
{
- return (get_rand_mod(2)) ? 1 : -1;
+ if (strlen(a->w_name) < randi || strlen(b->w_name) < randi)
+ return -1;
+ return a->w_name[randi] - b->w_name[randi];
}
/*
** WORKCMPF6 -- simple modification-time-only compare function.
@@ -3452,6 +3446,7 @@ dowork(qgrp, qdir, id, forkflag, requeueflag, e)
** handler for child process.
*/
+
/* Reset global flags */
RestartRequest = NULL;
RestartWorkGroup = false;
@@ -3638,6 +3633,7 @@ doworklist(el, forkflag, requeueflag)
** handler for child process.
*/
+
/* Reset global flags */
RestartRequest = NULL;
RestartWorkGroup = false;
@@ -6476,7 +6472,7 @@ write_key_file(keypath, key)
sff = SFF_NOLINK|SFF_ROOTOK|SFF_REGONLY|SFF_CREAT;
if (TrustedUid != 0 && RealUid == TrustedUid)
sff |= SFF_OPENASROOT;
- keyf = safefopen(keypath, O_WRONLY|O_TRUNC, 0644, sff);
+ keyf = safefopen(keypath, O_WRONLY|O_TRUNC, FileMode, sff);
if (keyf == NULL)
{
sm_syslog(LOG_ERR, NOQID, "unable to write %s: %s",
@@ -6486,7 +6482,7 @@ write_key_file(keypath, key)
{
ok = sm_io_fprintf(keyf, SM_TIME_DEFAULT, "%ld\n", key) !=
SM_IO_EOF;
- ok = ok && (sm_io_close(keyf, SM_TIME_DEFAULT) != SM_IO_EOF);
+ ok = (sm_io_close(keyf, SM_TIME_DEFAULT) != SM_IO_EOF) && ok;
}
return ok;
}
@@ -6514,9 +6510,9 @@ read_key_file(keypath, key)
if (keypath == NULL || *keypath == '\0')
return key;
sff = SFF_NOLINK|SFF_ROOTOK|SFF_REGONLY;
- if (TrustedUid != 0 && RealUid == TrustedUid)
+ if (RealUid == 0 || (TrustedUid != 0 && RealUid == TrustedUid))
sff |= SFF_OPENASROOT;
- keyf = safefopen(keypath, O_RDONLY, 0644, sff);
+ keyf = safefopen(keypath, O_RDONLY, FileMode, sff);
if (keyf == NULL)
{
sm_syslog(LOG_ERR, NOQID, "unable to read %s: %s",
@@ -6577,7 +6573,6 @@ init_shm(qn, owner, hash)
{
int count;
int save_errno;
- size_t shms;
count = 0;
shms = SM_T_SIZE + qn * sizeof(QUEUE_SHM_T);
@@ -8012,6 +8007,8 @@ split_within_queue(e)
e->e_sibling = firstsibling;
for (i = 0; i < nrcpt - 1; ++i)
addrs[i]->q_next = addrs[i + 1];
+ if (lsplits != NULL)
+ sm_free(lsplits);
return SM_SPLIT_FAIL;
}
@@ -8054,12 +8051,15 @@ split_within_queue(e)
break;
i += maxrcpt;
}
- if (LogLevel > SPLIT_LOG_LEVEL && lsplits != NULL && nsplit > 0)
+ if (LogLevel > SPLIT_LOG_LEVEL && lsplits != NULL)
{
- sm_syslog(LOG_NOTICE, e->e_id,
- "split: maxrcpts=%d, rcpts=%d, count=%d, id%s=%s",
- maxrcpt, nrcpt - ndead, nsplit,
- nsplit > 1 ? "s" : "", lsplits);
+ if (nsplit > 0)
+ {
+ sm_syslog(LOG_NOTICE, e->e_id,
+ "split: maxrcpts=%d, rcpts=%d, count=%d, id%s=%s",
+ maxrcpt, nrcpt - ndead, nsplit,
+ nsplit > 1 ? "s" : "", lsplits);
+ }
sm_free(lsplits);
}
return SM_SPLIT_NEW(nsplit);
diff --git a/contrib/sendmail/src/readcf.c b/contrib/sendmail/src/readcf.c
index fbfdef1..b527265 100644
--- a/contrib/sendmail/src/readcf.c
+++ b/contrib/sendmail/src/readcf.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: readcf.c,v 8.607.2.2 2002/08/19 21:50:49 gshapiro Exp $")
+SM_RCSID("@(#)$Id: readcf.c,v 8.607.2.7 2002/11/10 19:13:11 ca Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -2045,9 +2045,9 @@ static struct optioninfo
#define O_CLTKEYFILE 0xb7
{ "ClientKeyFile", O_CLTKEYFILE, OI_NONE },
#define O_CACERTFILE 0xb8
- { "CACERTFile", O_CACERTFILE, OI_NONE },
+ { "CACertFile", O_CACERTFILE, OI_NONE },
#define O_CACERTPATH 0xb9
- { "CACERTPath", O_CACERTPATH, OI_NONE },
+ { "CACertPath", O_CACERTPATH, OI_NONE },
#define O_DHPARAMS 0xba
{ "DHParameters", O_DHPARAMS, OI_NONE },
#define O_INPUTMILTER 0xbb
@@ -2100,6 +2100,14 @@ static struct optioninfo
# define O_SHMKEYFILE 0xd0
{ "SharedMemoryKeyFile", O_SHMKEYFILE, OI_NONE },
#endif /* _FFR_SELECT_SHM */
+#if _FFR_REJECT_LOG
+# define O_REJECTLOGINTERVAL 0xd1
+ { "RejectLogInterval", O_REJECTLOGINTERVAL, OI_NONE },
+#endif /* _FFR_REJECT_LOG */
+#if _FFR_REQ_DIR_FSYNC_OPT
+# define O_REQUIRES_DIR_FSYNC 0xd2
+ { "RequiresDirfsync", O_REQUIRES_DIR_FSYNC, OI_NONE },
+#endif /* _FFR_REQ_DIR_FSYNC_OPT */
{ NULL, '\0', OI_NONE }
};
@@ -3337,18 +3345,23 @@ setoption(opt, val, safe, sticky, e)
case 'A':
SASLOpts |= SASL_AUTH_AUTH;
break;
+
case 'a':
SASLOpts |= SASL_SEC_NOACTIVE;
break;
+
case 'c':
SASLOpts |= SASL_SEC_PASS_CREDENTIALS;
break;
+
case 'd':
SASLOpts |= SASL_SEC_NODICTIONARY;
break;
+
case 'f':
SASLOpts |= SASL_SEC_FORWARD_SECRECY;
break;
+
# if _FFR_SASL_OPT_M
/* to be activated in 8.13 */
# if SASL >= 20101
@@ -3357,16 +3370,20 @@ setoption(opt, val, safe, sticky, e)
break;
# endif /* SASL >= 20101 */
# endif /* _FFR_SASL_OPT_M */
+
case 'p':
SASLOpts |= SASL_SEC_NOPLAINTEXT;
break;
+
case 'y':
SASLOpts |= SASL_SEC_NOANONYMOUS;
break;
+
case ' ': /* ignore */
case '\t': /* ignore */
case ',': /* ignore */
break;
+
default:
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
"Warning: Option: %s unknown parameter '%c'\n",
@@ -3382,6 +3399,7 @@ setoption(opt, val, safe, sticky, e)
++val;
}
break;
+
case O_SASLBITS:
MaxSLBits = atoi(val);
break;
@@ -3399,17 +3417,17 @@ setoption(opt, val, safe, sticky, e)
#if STARTTLS
case O_SRVCERTFILE:
- SET_STRING_EXP(SrvCERTfile);
+ SET_STRING_EXP(SrvCertFile);
case O_SRVKEYFILE:
- SET_STRING_EXP(Srvkeyfile);
+ SET_STRING_EXP(SrvKeyFile);
case O_CLTCERTFILE:
- SET_STRING_EXP(CltCERTfile);
+ SET_STRING_EXP(CltCertFile);
case O_CLTKEYFILE:
- SET_STRING_EXP(Cltkeyfile);
+ SET_STRING_EXP(CltKeyFile);
case O_CACERTFILE:
- SET_STRING_EXP(CACERTfile);
+ SET_STRING_EXP(CACertFile);
case O_CACERTPATH:
- SET_STRING_EXP(CACERTpath);
+ SET_STRING_EXP(CACertPath);
case O_DHPARAMS:
SET_STRING_EXP(DHParams);
# if _FFR_TLS_1
@@ -3574,6 +3592,22 @@ setoption(opt, val, safe, sticky, e)
break;
#endif /* _FFR_SOFT_BOUNCE */
+#if _FFR_REJECT_LOG
+ case O_REJECTLOGINTERVAL: /* time btwn log msgs while refusing */
+ RejectLogInterval = convtime(val, 'h');
+ break;
+#endif /* _FFR_REJECT_LOG */
+
+#if _FFR_REQ_DIR_FSYNC_OPT
+ case O_REQUIRES_DIR_FSYNC:
+# if REQUIRES_DIR_FSYNC
+ RequiresDirfsync = atobool(val);
+# else /* REQUIRES_DIR_FSYNC */
+ /* silently ignored... required for cf file option */
+# endif /* REQUIRES_DIR_FSYNC */
+ break;
+#endif /* _FFR_REQ_DIR_FSYNC_OPT */
+
default:
if (tTd(37, 1))
{
diff --git a/contrib/sendmail/src/recipient.c b/contrib/sendmail/src/recipient.c
index 22b8377..186c8b6 100644
--- a/contrib/sendmail/src/recipient.c
+++ b/contrib/sendmail/src/recipient.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: recipient.c,v 8.330 2002/05/29 18:20:03 gshapiro Exp $")
+SM_RCSID("@(#)$Id: recipient.c,v 8.330.2.1 2002/08/27 20:21:02 gshapiro Exp $")
static void includetimeout __P((void));
static ADDRESS *self_reference __P((ADDRESS *));
@@ -679,7 +679,7 @@ recipient(new, sendq, aliaslevel, e)
** the current recipient is marked expensive.
*/
- if (WILL_BE_QUEUED(e->e_sendmode) ||
+ if (UseMSP || WILL_BE_QUEUED(e->e_sendmode) ||
(!bitset(EF_SPLIT, e->e_flags) && e->e_ntries == 0 &&
FastSplit > 0))
sortfn = sorthost;
diff --git a/contrib/sendmail/src/sasl.c b/contrib/sendmail/src/sasl.c
index b172677..4b30f47 100644
--- a/contrib/sendmail/src/sasl.c
+++ b/contrib/sendmail/src/sasl.c
@@ -9,7 +9,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: sasl.c,v 8.19.2.1 2002/07/13 18:04:56 ca Exp $")
+SM_RCSID("@(#)$Id: sasl.c,v 8.19.2.2 2002/09/26 23:03:40 gshapiro Exp $")
#if SASL
# include <stdlib.h>
@@ -208,7 +208,7 @@ intersect(s1, s2, rpool)
# if SASL >= 20000
/*
** IPTOSTRING -- create string for SASL_IP*PORT property
-** (borrowed from lib/iptostring.c in Cyrus-IMAP)
+** (borrowed from lib/iptostring.c in Cyrus-IMAP)
**
** Parameters:
** addr -- (pointer to) socket address
diff --git a/contrib/sendmail/src/savemail.c b/contrib/sendmail/src/savemail.c
index b28a70d..073c31f 100644
--- a/contrib/sendmail/src/savemail.c
+++ b/contrib/sendmail/src/savemail.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: savemail.c,v 8.299 2002/05/24 20:50:17 gshapiro Exp $")
+SM_RCSID("@(#)$Id: savemail.c,v 8.299.2.1 2002/10/23 15:08:47 ca Exp $")
static void errbody __P((MCI *, ENVELOPE *, char *));
static bool pruneroute __P((char *));
@@ -545,25 +545,7 @@ returntosender(msg, returnq, flags, e)
macdefine(&ee->e_macro, A_PERM, 'r', "");
macdefine(&ee->e_macro, A_PERM, 's', "localhost");
macdefine(&ee->e_macro, A_PERM, '_', "localhost");
-#if SASL
- macdefine(&ee->e_macro, A_PERM, macid("{auth_type}"), "");
- macdefine(&ee->e_macro, A_PERM, macid("{auth_authen}"), "");
- macdefine(&ee->e_macro, A_PERM, macid("{auth_author}"), "");
- macdefine(&ee->e_macro, A_PERM, macid("{auth_ssf}"), "");
-#endif /* SASL */
-#if STARTTLS
- macdefine(&ee->e_macro, A_PERM, macid("{cert_issuer}"), "");
- macdefine(&ee->e_macro, A_PERM, macid("{cert_subject}"), "");
- macdefine(&ee->e_macro, A_PERM, macid("{cipher_bits}"), "");
- macdefine(&ee->e_macro, A_PERM, macid("{cipher}"), "");
- macdefine(&ee->e_macro, A_PERM, macid("{tls_version}"), "");
- macdefine(&ee->e_macro, A_PERM, macid("{verify}"), "");
-# if _FFR_TLS_1
- macdefine(&ee->e_macro, A_PERM, macid("{alg_bits}"), "");
- macdefine(&ee->e_macro, A_PERM, macid("{cn_issuer}"), "");
- macdefine(&ee->e_macro, A_PERM, macid("{cn_subject}"), "");
-# endif /* _FFR_TLS_1 */
-#endif /* STARTTLS */
+ clrsessenvelope(ee);
ee->e_puthdr = putheader;
ee->e_putbody = errbody;
diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h
index 7dc34fa..61b0d13 100644
--- a/contrib/sendmail/src/sendmail.h
+++ b/contrib/sendmail/src/sendmail.h
@@ -48,7 +48,7 @@
#ifdef _DEFINE
# ifndef lint
-SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.919.2.4 2002/08/16 14:56:01 ca Exp $";
+SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.919.2.15 2002/12/12 22:46:35 ca Exp $";
# endif /* ! lint */
#endif /* _DEFINE */
@@ -392,6 +392,9 @@ struct mailer
#define M_ESMTP 'a' /* run Extended SMTP */
#define M_ALIASABLE 'A' /* user can be LHS of an alias */
#define M_BLANKEND 'b' /* ensure blank line at end of message */
+#if _FFR_STRIPBACKSL
+# define M_STRIPBACKSL 'B' /* strip leading backslash from user */
+#endif /* _FFR_STRIPBACKSL */
#define M_NOCOMMENT 'c' /* don't include comment part of address */
#define M_CANONICAL 'C' /* make addresses canonical "u@dom" */
#define M_NOBRACKET 'd' /* never angle bracket envelope route-addrs */
@@ -581,7 +584,7 @@ extern bool filesys_free __P((long));
ERROR: change SASL_SEC_MASK_ notify sendmail.org!
# endif /* SASL_SEC_NOPLAINTEXT & SASL_SEC_MASK) == 0 ... */
# endif /* SASL >= 20101 */
-# define MAXOUTLEN 1024 /* length of output buffer */
+# define MAXOUTLEN 8192 /* length of output buffer */
/* functions */
extern char *intersect __P((char *, char *, SM_RPOOL_T *));
@@ -690,6 +693,7 @@ MCI
#define MCIF_AUTHACT 0x00010000 /* SASL (AUTH) active */
#define MCIF_ENHSTAT 0x00020000 /* ENHANCEDSTATUSCODES supported */
#define MCIF_PIPELINED 0x00040000 /* PIPELINING supported */
+#define MCIF_VERB 0x00080000 /* VERB supported */
#if STARTTLS
#define MCIF_TLS 0x00100000 /* STARTTLS supported */
#define MCIF_TLSACT 0x00200000 /* STARTTLS active */
@@ -955,6 +959,7 @@ extern ENVELOPE BlankEnvelope;
extern void clearenvelope __P((ENVELOPE *, bool, SM_RPOOL_T *));
extern void dropenvelope __P((ENVELOPE *, bool, bool));
extern ENVELOPE *newenvelope __P((ENVELOPE *, ENVELOPE *, SM_RPOOL_T *));
+extern void clrsessenvelope __P((ENVELOPE *));
extern void printenvflags __P((ENVELOPE *));
extern void putbody __P((MCI *, ENVELOPE *, char *));
extern void putheader __P((MCI *, HDR *, ENVELOPE *, int));
@@ -1567,7 +1572,7 @@ EXTERN unsigned long PrivacyFlags; /* privacy flags */
** Flags passed to rscheck
*/
-#define RSF_RMCOMM 0x0001 /* strip comments */
+#define RSF_RMCOMM 0x0001 /* strip comments */
#define RSF_UNSTRUCTURED 0x0002 /* unstructured, ignore syntax errors */
#define RSF_COUNT 0x0004 /* count rejections (statistics)? */
@@ -1769,14 +1774,14 @@ struct termescape
/* what to do in the TLS initialization */
#define TLS_I_NONE 0x00000000 /* no requirements... */
-#define TLS_I_CERT_EX 0x00000001 /* CERT must exist */
-#define TLS_I_CERT_UNR 0x00000002 /* CERT must be g/o unreadable */
-#define TLS_I_KEY_EX 0x00000004 /* KEY must exist */
-#define TLS_I_KEY_UNR 0x00000008 /* KEY must be g/o unreadable */
-#define TLS_I_CERTP_EX 0x00000010 /* CA CERT PATH must exist */
-#define TLS_I_CERTP_UNR 0x00000020 /* CA CERT PATH must be g/o unreadable */
-#define TLS_I_CERTF_EX 0x00000040 /* CA CERT FILE must exist */
-#define TLS_I_CERTF_UNR 0x00000080 /* CA CERT FILE must be g/o unreadable */
+#define TLS_I_CERT_EX 0x00000001 /* cert must exist */
+#define TLS_I_CERT_UNR 0x00000002 /* cert must be g/o unreadable */
+#define TLS_I_KEY_EX 0x00000004 /* key must exist */
+#define TLS_I_KEY_UNR 0x00000008 /* key must be g/o unreadable */
+#define TLS_I_CERTP_EX 0x00000010 /* CA cert path must exist */
+#define TLS_I_CERTP_UNR 0x00000020 /* CA cert path must be g/o unreadable */
+#define TLS_I_CERTF_EX 0x00000040 /* CA cert file must exist */
+#define TLS_I_CERTF_UNR 0x00000080 /* CA cert file must be g/o unreadable */
#define TLS_I_RSA_TMP 0x00000100 /* RSA TMP must be generated */
#define TLS_I_USE_KEY 0x00000200 /* private key must usable */
#define TLS_I_USE_CERT 0x00000400 /* certificate must be usable */
@@ -1791,7 +1796,7 @@ struct termescape
#define TLS_I_DH1024 0x00080000 /* generate 1024bit DH param */
#define TLS_I_DH2048 0x00100000 /* generate 2048bit DH param */
#define TLS_I_NO_VRFY 0x00200000 /* do not require authentication */
-#define TLS_I_KEY_OUNR 0x00400000 /* KEY must be o unreadable */
+#define TLS_I_KEY_OUNR 0x00400000 /* Key must be other unreadable */
/* require server cert */
#define TLS_I_SRV_CERT (TLS_I_CERT_EX | TLS_I_KEY_EX | \
@@ -1821,18 +1826,18 @@ extern int endtls __P((SSL *, char *));
extern void tlslogerr __P((char *));
-EXTERN char *CACERTpath; /* path to CA certificates (dir. with hashes) */
-EXTERN char *CACERTfile; /* file with CA certificate */
-EXTERN char *CltCERTfile; /* file with client certificate */
-EXTERN char *Cltkeyfile; /* file with client private key */
+EXTERN char *CACertPath; /* path to CA certificates (dir. with hashes) */
+EXTERN char *CACertFile; /* file with CA certificate */
+EXTERN char *CltCertFile; /* file with client certificate */
+EXTERN char *CltKeyFile; /* file with client private key */
# if _FFR_TLS_1
EXTERN char *CipherList; /* list of ciphers */
EXTERN char *DHParams5; /* file with DH parameters (512) */
# endif /* _FFR_TLS_1 */
EXTERN char *DHParams; /* file with DH parameters */
EXTERN char *RandFile; /* source of random data */
-EXTERN char *SrvCERTfile; /* file with server certificate */
-EXTERN char *Srvkeyfile; /* file with server private key */
+EXTERN char *SrvCertFile; /* file with server certificate */
+EXTERN char *SrvKeyFile; /* file with server private key */
EXTERN unsigned long TLS_Srv_Opts; /* TLS server options */
#endif /* STARTTLS */
@@ -1904,6 +1909,14 @@ struct queue_char
struct queue_char *queue_next;
};
+/* run_work_group() flags */
+#define RWG_NONE 0x0000
+#define RWG_FORK 0x0001
+#define RWG_VERBOSE 0x0002
+#define RWG_PERSISTENT 0x0004
+#define RWG_FORCE 0x0008
+#define RWG_RUNALL 0x0010
+
typedef struct queue_char QUEUE_CHAR;
EXTERN int volatile CurRunners; /* current number of runner children */
@@ -1949,7 +1962,7 @@ extern void quarantine_queue __P((char *, int));
extern char *queuename __P((ENVELOPE *, int));
extern void queueup __P((ENVELOPE *, bool, bool));
extern bool runqueue __P((bool, bool, bool, bool));
-extern int run_work_group __P((int, bool, bool, bool, bool));
+extern int run_work_group __P((int, int));
extern void set_def_queueval __P((QUEUEGRP *, bool));
extern void setup_queues __P((bool));
extern bool setnewqueue __P((ENVELOPE *));
@@ -2134,6 +2147,9 @@ EXTERN bool NoAlias; /* suppress aliasing */
EXTERN bool NoConnect; /* don't connect to non-local mailers */
EXTERN bool OnlyOneError; /* .... or only want to give one SMTP reply */
EXTERN bool QuickAbort; /* .... but only if we want a quick abort */
+#if _FFR_REQ_DIR_FSYNC_OPT
+EXTERN bool RequiresDirfsync; /* requires fsync() for directory */
+#endif /* _FFR_REQ_DIR_FSYNC_OPT */
EXTERN bool ResNoAliases; /* don't use $HOSTALIASES */
EXTERN bool volatile RestartWorkGroup; /* daemon needs to restart some work groups */
EXTERN bool RrtImpliesDsn; /* turn Return-Receipt-To: into DSN */
@@ -2194,6 +2210,9 @@ EXTERN int NumFileSys; /* number of queue file systems */
EXTERN int QueueLA; /* load average starting forced queueing */
EXTERN int RefuseLA; /* load average refusing connections */
+#if _FFR_REJECT_LOG
+EXTERN time_t RejectLogInterval; /* time btwn log msgs while refusing */
+#endif /* _FFR_REJECT_LOG */
EXTERN int SuperSafe; /* be extra careful, even if expensive */
EXTERN int VendorCode; /* vendor-specific operation enhancements */
EXTERN int Verbose; /* set if blow-by-blow desired */
@@ -2459,7 +2478,9 @@ extern void makeworkgroups __P((void));
extern void mark_work_group_restart __P((int, int));
extern char * munchstring __P((char *, char **, int));
extern struct hostent *myhostname __P((char *, int));
+#if NISPLUS
extern char *nisplus_default_domain __P((void)); /* extern for Sun */
+#endif /* NISPLUS */
extern bool path_is_dir __P((char *, bool));
extern int pickqdir __P((QUEUEGRP *qg, long fsize, ENVELOPE *e));
extern char *pintvl __P((time_t, bool));
@@ -2508,6 +2529,9 @@ extern pid_t sm_wait __P((int *));
extern bool split_by_recipient __P((ENVELOPE *e));
extern void stop_sendmail __P((void));
extern char *str2prt __P((char *));
+#if _FFR_STRIPBACKSL
+extern void stripbackslash __P((char *));
+#endif /* _FFR_STRIPBACKSL */
extern bool strreplnonprt __P((char *, int));
extern bool strcontainedin __P((bool, char *, char *));
extern int switch_map_find __P((char *, char *[], short []));
diff --git a/contrib/sendmail/src/sfsasl.c b/contrib/sendmail/src/sfsasl.c
index dc87429..030ce74 100644
--- a/contrib/sendmail/src/sfsasl.c
+++ b/contrib/sendmail/src/sfsasl.c
@@ -9,7 +9,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: sfsasl.c,v 8.91.2.1 2002/08/27 01:35:17 ca Exp $")
+SM_RCSID("@(#)$Id: sfsasl.c,v 8.91.2.2 2002/09/12 21:07:50 ca Exp $")
#include <stdlib.h>
#include <sendmail.h>
#include <errno.h>
@@ -177,7 +177,7 @@ sasl_read(fp, buf, size)
int result;
ssize_t len;
# if SASL >= 20000
- const char *outbuf = NULL;
+ static const char *outbuf = NULL;
# else /* SASL >= 20000 */
static char *outbuf = NULL;
# endif /* SASL >= 20000 */
@@ -194,7 +194,11 @@ sasl_read(fp, buf, size)
** if necessary.
*/
+# if SASL >= 20000
+ while (outlen == 0)
+# else /* SASL >= 20000 */
while (outbuf == NULL && outlen == 0)
+# endif /* SASL >= 20000 */
{
len = sm_io_read(so->fp, SM_TIME_DEFAULT, buf, size);
if (len <= 0)
diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c
index 8bbc029..12ad2e7 100644
--- a/contrib/sendmail/src/srvrsmtp.c
+++ b/contrib/sendmail/src/srvrsmtp.c
@@ -16,7 +16,7 @@
# include <libmilter/mfdef.h>
#endif /* MILTER */
-SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.829.2.4 2002/08/16 14:56:01 ca Exp $")
+SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.829.2.17 2002/12/09 16:46:18 ca Exp $")
#if SASL || STARTTLS
# include <sys/time.h>
@@ -218,6 +218,18 @@ static void smtp_data __P((SMTP_T *, ENVELOPE *));
#if MILTER
# define MILTER_ABORT(e) milter_abort((e))
+
+#if _FFR_MILTER_421
+# define MILTER_SHUTDOWN \
+ if (strncmp(response, "421 ", 4) == 0) \
+ { \
+ e->e_sendqueue = NULL; \
+ goto doquit; \
+ }
+#else /* _FFR_MILTER_421 */
+# define MILTER_SHUTDOWN
+#endif /* _FFR_MILTER_421 */
+
# define MILTER_REPLY(str) \
{ \
int savelogusrerrs = LogUsrErrs; \
@@ -233,6 +245,7 @@ static void smtp_data __P((SMTP_T *, ENVELOPE *));
LogUsrErrs = false; \
} \
usrerr(response); \
+ MILTER_SHUTDOWN \
break; \
\
case SMFIR_REJECT: \
@@ -355,9 +368,9 @@ smtp(nullserver, d_flags, e)
volatile unsigned int n_noop = 0; /* count of NOOP/VERB/etc */
volatile unsigned int n_helo = 0; /* count of HELO/EHLO */
bool ok;
-#if _FFR_ADAPTIVE_EOL
+#if _FFR_BLOCK_PROXIES || _FFR_ADAPTIVE_EOL
volatile bool first;
-#endif /* _FFR_ADAPTIVE_EOL */
+#endif /* _FFR_BLOCK_PROXIES || _FFR_ADAPTIVE_EOL */
volatile bool tempfail = false;
volatile time_t wt; /* timeout after too many commands */
volatile time_t previous; /* time after checksmtpattack() */
@@ -726,6 +739,23 @@ smtp(nullserver, d_flags, e)
tempfail = true;
smtp.sm_milterize = false;
break;
+
+#if _FFR_MILTER_421
+ case SMFIR_SHUTDOWN:
+ if (MilterLogLevel > 3)
+ sm_syslog(LOG_INFO, e->e_id,
+ "Milter: connect: host=%s, addr=%s, shutdown",
+ peerhostname,
+ anynet_ntoa(&RealHostAddr));
+ tempfail = true;
+ smtp.sm_milterize = false;
+ message("421 4.7.0 %s closing connection",
+ MyHostName);
+
+ /* arrange to ignore send list */
+ e->e_sendqueue = NULL;
+ goto doquit;
+#endif /* _FFR_MILTER_421 */
}
if (response != NULL)
@@ -797,9 +827,9 @@ smtp(nullserver, d_flags, e)
/* sendinghost's storage must outlive the current envelope */
if (sendinghost != NULL)
sendinghost = sm_strdup_x(sendinghost);
-#if _FFR_ADAPTIVE_EOL
+#if _FFR_BLOCK_PROXIES || _FFR_ADAPTIVE_EOL
first = true;
-#endif /* _FFR_ADAPTIVE_EOL */
+#endif /* _FFR_BLOCK_PROXIES || _FFR_ADAPTIVE_EOL */
gothello = false;
smtp.sm_gotmail = false;
for (;;)
@@ -851,7 +881,7 @@ smtp(nullserver, d_flags, e)
MyHostName, CurSmtpClient);
if (LogLevel > (smtp.sm_gotmail ? 1 : 19))
sm_syslog(LOG_NOTICE, e->e_id,
- "lost input channel from %.100s to %s after %s",
+ "lost input channel from %s to %s after %s",
CurSmtpClient, d,
(c == NULL || c->cmd_name == NULL) ? "startup" : c->cmd_name);
/*
@@ -864,9 +894,36 @@ smtp(nullserver, d_flags, e)
goto doquit;
}
-#if _FFR_ADAPTIVE_EOL
+#if _FFR_BLOCK_PROXIES || _FFR_ADAPTIVE_EOL
if (first)
{
+#if _FFR_BLOCK_PROXIES
+ size_t inplen, cmdlen;
+ int idx;
+ char *http_cmd;
+ static char *http_cmds[] = { "GET", "POST",
+ "CONNECT", "USER", NULL };
+
+ inplen = strlen(inp);
+ for (idx = 0; (http_cmd = http_cmds[idx]) != NULL;
+ idx++)
+ {
+ cmdlen = strlen(http_cmd);
+ if (cmdlen < inplen &&
+ sm_strncasecmp(inp, http_cmd, cmdlen) == 0 &&
+ isascii(inp[cmdlen]) && isspace(inp[cmdlen]))
+ {
+ /* Open proxy, drop it */
+ message("421 4.7.0 %s Rejecting open proxy %s",
+ MyHostName, CurSmtpClient);
+ sm_syslog(LOG_INFO, e->e_id,
+ "%s: probable open proxy: command=%.40s",
+ CurSmtpClient, inp);
+ goto doquit;
+ }
+ }
+#endif /* _FFR_BLOCK_PROXIES */
+#if _FFR_ADAPTIVE_EOL
char *p;
smtp.sm_crlf = true;
@@ -878,13 +935,14 @@ smtp(nullserver, d_flags, e)
{
/* how many bad guys are there? */
sm_syslog(LOG_INFO, NOQID,
- "%.100s did not use CRLF",
+ "%s did not use CRLF",
CurSmtpClient);
}
}
+#endif /* _FFR_ADAPTIVE_EOL */
first = false;
}
-#endif /* _FFR_ADAPTIVE_EOL */
+#endif /* _FFR_BLOCK_PROXIES || _FFR_ADAPTIVE_EOL */
/* clean up end of line */
fixcrlf(inp, true);
@@ -900,7 +958,7 @@ smtp(nullserver, d_flags, e)
*/
if (bitset(SRV_NO_PIPE, features) &&
- sm_io_getinfo(InChannel, SM_IO_IS_READABLE, NULL))
+ sm_io_getinfo(InChannel, SM_IO_IS_READABLE, NULL) > 0)
{
if (++np_log < 3)
sm_syslog(LOG_INFO, NOQID,
@@ -1054,7 +1112,7 @@ smtp(nullserver, d_flags, e)
/* NULL pointer ok since it's our function */
if (LogLevel > 8)
sm_syslog(LOG_INFO, NOQID,
- "AUTH=server, relay=%.100s, authid=%.128s, mech=%.16s, bits=%d",
+ "AUTH=server, relay=%s, authid=%.128s, mech=%.16s, bits=%d",
CurSmtpClient,
shortenstring(user, 128),
auth_type, *ssf);
@@ -1250,7 +1308,7 @@ smtp(nullserver, d_flags, e)
{
if (LogLevel > 9)
sm_syslog(LOG_INFO, e->e_id,
- "SMTP AUTH command (%.100s) from %.100s tempfailed (due to previous checks)",
+ "SMTP AUTH command (%.100s) from %s tempfailed (due to previous checks)",
p, CurSmtpClient);
usrerr("454 4.7.1 Please try again later");
break;
@@ -1419,7 +1477,7 @@ smtp(nullserver, d_flags, e)
{
if (LogLevel > 9)
sm_syslog(LOG_INFO, e->e_id,
- "SMTP STARTTLS command (%.100s) from %.100s tempfailed (due to previous checks)",
+ "SMTP STARTTLS command (%.100s) from %s tempfailed (due to previous checks)",
p, CurSmtpClient);
usrerr("454 4.7.1 Please try again later");
break;
@@ -1533,6 +1591,22 @@ smtp(nullserver, d_flags, e)
tv.tv_usec = 0;
}
+ if (!timedout && FD_SETSIZE > 0 &&
+ (rfd >= FD_SETSIZE ||
+ (i == SSL_ERROR_WANT_WRITE &&
+ wfd >= FD_SETSIZE)))
+ {
+ if (LogLevel > 5)
+ {
+ sm_syslog(LOG_ERR, NOQID,
+ "STARTTLS=server, error: fd %d/%d too large",
+ rfd, wfd);
+ if (LogLevel > 8)
+ tlslogerr("server");
+ }
+ goto tlsfail;
+ }
+
/* XXX what about SSL_pending() ? */
if (!timedout && i == SSL_ERROR_WANT_READ)
{
@@ -1566,6 +1640,7 @@ smtp(nullserver, d_flags, e)
if (LogLevel > 8)
tlslogerr("server");
}
+tlsfail:
tls_ok_srv = false;
SSL_free(srv_ssl);
srv_ssl = NULL;
@@ -1723,7 +1798,7 @@ smtp(nullserver, d_flags, e)
usrerr("501 Invalid domain name");
if (LogLevel > 9)
sm_syslog(LOG_INFO, CurEnv->e_id,
- "invalid domain name (too long) from %.100s",
+ "invalid domain name (too long) from %s",
CurSmtpClient);
break;
}
@@ -1757,7 +1832,7 @@ smtp(nullserver, d_flags, e)
usrerr("501 Invalid domain name");
if (LogLevel > 9)
sm_syslog(LOG_INFO, CurEnv->e_id,
- "invalid domain name (%.100s) from %.100s",
+ "invalid domain name (%s) from %.100s",
p, CurSmtpClient);
break;
}
@@ -1943,7 +2018,7 @@ smtp(nullserver, d_flags, e)
{
if (LogLevel > 9)
sm_syslog(LOG_INFO, e->e_id,
- "SMTP MAIL command (%.100s) from %.100s tempfailed (due to previous checks)",
+ "SMTP MAIL command (%.100s) from %s tempfailed (due to previous checks)",
p, CurSmtpClient);
usrerr(MSG_TEMPFAIL);
break;
@@ -2267,7 +2342,7 @@ smtp(nullserver, d_flags, e)
n_badrcpts == BadRcptThrottle)
{
sm_syslog(LOG_INFO, e->e_id,
- "%.100s: Possible SMTP RCPT flood, throttling.",
+ "%s: Possible SMTP RCPT flood, throttling.",
CurSmtpClient);
/* To avoid duplicated message */
@@ -2479,7 +2554,7 @@ smtp(nullserver, d_flags, e)
{
if (LogLevel > 9)
sm_syslog(LOG_INFO, e->e_id,
- "SMTP %s command (%.100s) from %.100s tempfailed (due to previous checks)",
+ "SMTP %s command (%.100s) from %s tempfailed (due to previous checks)",
vrfy ? "VRFY" : "EXPN",
p, CurSmtpClient);
@@ -2490,8 +2565,8 @@ smtp(nullserver, d_flags, e)
wt = checksmtpattack(&n_verifies, MAXVRFYCOMMANDS,
false, vrfy ? "VRFY" : "EXPN", e);
previous = curtime();
- if (bitset(vrfy ? PRIV_NOVRFY : PRIV_NOEXPN,
- PrivacyFlags))
+ if ((vrfy && bitset(PRIV_NOVRFY, PrivacyFlags)) ||
+ (!vrfy && !bitset(SRV_OFFER_EXPN, features)))
{
if (vrfy)
message("252 2.5.2 Cannot VRFY user; try RCPT to attempt delivery (or try finger)");
@@ -2499,7 +2574,7 @@ smtp(nullserver, d_flags, e)
message("502 5.7.0 Sorry, we do not allow this operation");
if (LogLevel > 5)
sm_syslog(LOG_INFO, e->e_id,
- "%.100s: %s [rejected]",
+ "%s: %s [rejected]",
CurSmtpClient,
shortenstring(inp, MAXSHORTSTR));
break;
@@ -2514,7 +2589,7 @@ smtp(nullserver, d_flags, e)
if (Errors > 0)
break;
if (LogLevel > 5)
- sm_syslog(LOG_INFO, e->e_id, "%.100s: %s",
+ sm_syslog(LOG_INFO, e->e_id, "%s: %s",
CurSmtpClient,
shortenstring(inp, MAXSHORTSTR));
SM_TRY
@@ -2594,7 +2669,7 @@ smtp(nullserver, d_flags, e)
message("502 5.7.0 Sorry, we do not allow this operation");
if (LogLevel > 5)
sm_syslog(LOG_INFO, e->e_id,
- "%.100s: %s [rejected]",
+ "%s: %s [rejected]",
CurSmtpClient,
shortenstring(inp, MAXSHORTSTR));
break;
@@ -2603,7 +2678,7 @@ smtp(nullserver, d_flags, e)
{
if (LogLevel > 9)
sm_syslog(LOG_INFO, e->e_id,
- "SMTP ETRN command (%.100s) from %.100s tempfailed (due to previous checks)",
+ "SMTP ETRN command (%.100s) from %s tempfailed (due to previous checks)",
p, CurSmtpClient);
usrerr(MSG_TEMPFAIL);
break;
@@ -2636,7 +2711,7 @@ smtp(nullserver, d_flags, e)
if (LogLevel > 5)
sm_syslog(LOG_INFO, e->e_id,
- "%.100s: ETRN %s", CurSmtpClient,
+ "%s: ETRN %s", CurSmtpClient,
shortenstring(p, MAXSHORTSTR));
id = p;
@@ -2652,8 +2727,7 @@ smtp(nullserver, d_flags, e)
id);
break;
}
- ok = run_work_group(wgrp, true, false,
- false, true);
+ ok = run_work_group(wgrp, RWG_FORK|RWG_RUNALL);
if (ok && Errors == 0)
message("250 2.0.0 Queuing for queue group %s started", id);
break;
@@ -2751,20 +2825,21 @@ doquit:
*/
sm_syslog(LOG_INFO, e->e_id,
- "%.100s did not issue MAIL/EXPN/VRFY/ETRN during connection to %s",
+ "%s did not issue MAIL/EXPN/VRFY/ETRN during connection to %s",
CurSmtpClient, d);
}
-#if PROFILING
- return;
-#endif /* PROFILING */
+ if (tTd(93, 100))
+ {
+ /* return to handle next connection */
+ return;
+ }
finis(true, true, ExitStat);
/* NOTREACHED */
case CMDVERB: /* set verbose mode */
DELAY_CONN("VERB");
- if (bitset(PRIV_NOEXPN, PrivacyFlags) ||
- !bitset(SRV_OFFER_VERB, features) ||
- bitset(PRIV_NOVERB, PrivacyFlags))
+ if (!bitset(SRV_OFFER_EXPN, features) ||
+ !bitset(SRV_OFFER_VERB, features))
{
/* this would give out the same info */
message("502 5.7.0 Verbose unavailable");
@@ -2798,7 +2873,7 @@ doquit:
DELAY_CONN("Bogus");
if (LogLevel > 0)
sm_syslog(LOG_CRIT, e->e_id,
- "\"%s\" command from %.100s (%.100s)",
+ "\"%s\" command from %s (%.100s)",
c->cmd_name, CurSmtpClient,
anynet_ntoa(&RealHostAddr));
/* FALLTHROUGH */
@@ -3289,7 +3364,7 @@ checksmtpattack(pcounter, maxcount, waitnow, cname, e)
if (*pcounter == maxcount && LogLevel > 5)
{
sm_syslog(LOG_INFO, e->e_id,
- "%.100s: possible SMTP attack: command=%.40s, count=%u",
+ "%s: possible SMTP attack: command=%.40s, count=%u",
CurSmtpClient, cname, *pcounter);
}
s = 1 << (*pcounter - maxcount);
@@ -4014,8 +4089,8 @@ initsrvtls(tls_ok)
return false;
/* do NOT remove assignment */
- tls_ok_srv = inittls(&srv_ctx, TLS_Srv_Opts, true, SrvCERTfile,
- Srvkeyfile, CACERTpath, CACERTfile, DHParams);
+ tls_ok_srv = inittls(&srv_ctx, TLS_Srv_Opts, true, SrvCertFile,
+ SrvKeyFile, CACertPath, CACertFile, DHParams);
return tls_ok_srv;
}
#endif /* STARTTLS */
@@ -4039,21 +4114,21 @@ static struct
} srv_feat_table[] =
{
{ 'A', SRV_OFFER_AUTH },
- { 'B', SRV_OFFER_VERB },
- { 'D', SRV_OFFER_DSN },
- { 'E', SRV_OFFER_ETRN },
- { 'L', SRV_REQ_AUTH }, /* not documented in 8.12 */
+ { 'B', SRV_OFFER_VERB }, /* FFR; not documented in 8.12 */
+ { 'D', SRV_OFFER_DSN }, /* FFR; not documented in 8.12 */
+ { 'E', SRV_OFFER_ETRN }, /* FFR; not documented in 8.12 */
+ { 'L', SRV_REQ_AUTH }, /* FFR; not documented in 8.12 */
#if PIPELINING
# if _FFR_NO_PIPE
{ 'N', SRV_NO_PIPE },
# endif /* _FFR_NO_PIPE */
{ 'P', SRV_OFFER_PIPE },
#endif /* PIPELINING */
- { 'R', SRV_VRFY_CLT },
+ { 'R', SRV_VRFY_CLT }, /* FFR; not documented in 8.12 */
{ 'S', SRV_OFFER_TLS },
/* { 'T', SRV_TMP_FAIL }, */
{ 'V', SRV_VRFY_CLT },
- { 'X', SRV_OFFER_EXPN },
+ { 'X', SRV_OFFER_EXPN }, /* FFR; not documented in 8.12 */
/* { 'Y', SRV_OFFER_VRFY }, */
{ '\0', SRV_NONE }
};
diff --git a/contrib/sendmail/src/sysexits.c b/contrib/sendmail/src/sysexits.c
index 5cce2b7..2781b07 100644
--- a/contrib/sendmail/src/sysexits.c
+++ b/contrib/sendmail/src/sysexits.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: sysexits.c,v 8.33 2001/09/11 04:05:17 gshapiro Exp $")
+SM_RCSID("@(#)$Id: sysexits.c,v 8.33.4.1 2002/09/09 02:42:37 gshapiro Exp $")
/*
** DSNTOEXITSTAT -- convert DSN-style error code to EX_ style.
@@ -37,6 +37,10 @@ dsntoexitstat(dsncode)
if (*dsncode == '4')
return EX_TEMPFAIL;
+ /* reject other illegal values */
+ if (*dsncode != '5')
+ return EX_CONFIG;
+
/* now decode the other two field parts */
if (*++dsncode == '.')
dsncode++;
@@ -75,7 +79,8 @@ dsntoexitstat(dsncode)
return EX_UNAVAILABLE;
case 5: /* Destination address valid */
- return EX_OK;
+ /* According to RFC1893, this can't happen */
+ return EX_CONFIG;
}
break;
@@ -130,7 +135,7 @@ dsntoexitstat(dsncode)
case 7: /* Security Status */
return EX_DATAERR;
}
- return EX_CONFIG;
+ return EX_UNAVAILABLE;
}
/*
** EXITSTAT -- convert EX_ value to error text.
diff --git a/contrib/sendmail/src/tls.c b/contrib/sendmail/src/tls.c
index e2b1b14..8a7fa9f 100644
--- a/contrib/sendmail/src/tls.c
+++ b/contrib/sendmail/src/tls.c
@@ -10,7 +10,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: tls.c,v 8.79 2002/03/21 22:24:13 gshapiro Exp $")
+SM_RCSID("@(#)$Id: tls.c,v 8.79.4.1 2002/09/03 17:31:45 gshapiro Exp $")
#if STARTTLS
# include <openssl/err.h>
@@ -326,21 +326,21 @@ tls_set_verify(ctx, ssl, vrfy)
** [due to permissions]
*/
-# define TLS_S_NONE 0x00000000 /* none yet */
-# define TLS_S_CERT_EX 0x00000001 /* CERT file exists */
-# define TLS_S_CERT_OK 0x00000002 /* CERT file is ok */
-# define TLS_S_KEY_EX 0x00000004 /* KEY file exists */
-# define TLS_S_KEY_OK 0x00000008 /* KEY file is ok */
-# define TLS_S_CERTP_EX 0x00000010 /* CA CERT PATH exists */
-# define TLS_S_CERTP_OK 0x00000020 /* CA CERT PATH is ok */
-# define TLS_S_CERTF_EX 0x00000040 /* CA CERT FILE exists */
-# define TLS_S_CERTF_OK 0x00000080 /* CA CERT FILE is ok */
+# define TLS_S_NONE 0x00000000 /* none yet */
+# define TLS_S_CERT_EX 0x00000001 /* cert file exists */
+# define TLS_S_CERT_OK 0x00000002 /* cert file is ok */
+# define TLS_S_KEY_EX 0x00000004 /* key file exists */
+# define TLS_S_KEY_OK 0x00000008 /* key file is ok */
+# define TLS_S_CERTP_EX 0x00000010 /* CA cert path exists */
+# define TLS_S_CERTP_OK 0x00000020 /* CA cert path is ok */
+# define TLS_S_CERTF_EX 0x00000040 /* CA cert file exists */
+# define TLS_S_CERTF_OK 0x00000080 /* CA cert file is ok */
# if _FFR_TLS_1
-# define TLS_S_CERT2_EX 0x00001000 /* 2nd CERT file exists */
-# define TLS_S_CERT2_OK 0x00002000 /* 2nd CERT file is ok */
-# define TLS_S_KEY2_EX 0x00004000 /* 2nd KEY file exists */
-# define TLS_S_KEY2_OK 0x00008000 /* 2nd KEY file is ok */
+# define TLS_S_CERT2_EX 0x00001000 /* 2nd cert file exists */
+# define TLS_S_CERT2_OK 0x00002000 /* 2nd cert file is ok */
+# define TLS_S_KEY2_EX 0x00004000 /* 2nd key file exists */
+# define TLS_S_KEY2_OK 0x00008000 /* 2nd key file is ok */
# endif /* _FFR_TLS_1 */
# define TLS_S_DH_OK 0x00200000 /* DH cert is ok */
@@ -545,9 +545,9 @@ inittls(ctx, req, srv, certfile, keyfile, cacertpath, cacertfile, dhparam)
TLS_S_CERT_EX, srv);
TLS_OK_F(keyfile, "KeyFile", bitset(TLS_I_KEY_EX, req),
TLS_S_KEY_EX, srv);
- TLS_OK_F(cacertpath, "CACERTPath", bitset(TLS_I_CERTP_EX, req),
+ TLS_OK_F(cacertpath, "CACertPath", bitset(TLS_I_CERTP_EX, req),
TLS_S_CERTP_EX, srv);
- TLS_OK_F(cacertfile, "CACERTFile", bitset(TLS_I_CERTF_EX, req),
+ TLS_OK_F(cacertfile, "CACertFile", bitset(TLS_I_CERTF_EX, req),
TLS_S_CERTF_EX, srv);
# if _FFR_TLS_1
diff --git a/contrib/sendmail/src/trace.c b/contrib/sendmail/src/trace.c
index 701a949..a10b9f1 100644
--- a/contrib/sendmail/src/trace.c
+++ b/contrib/sendmail/src/trace.c
@@ -15,7 +15,7 @@
#include <sm/debug.h>
#include <sm/string.h>
-SM_RCSID("@(#)$Id: trace.c,v 8.37 2001/09/11 04:05:17 gshapiro Exp $")
+SM_RCSID("@(#)$Id: trace.c,v 8.37.4.1 2002/12/05 17:28:05 ca Exp $")
static char *tTnewflag __P((char *));
static char *tToldflag __P((char *));
@@ -204,7 +204,7 @@ void
tTflag(s)
register char *s;
{
- if (*s == '\0')
+ if (s == NULL || *s == '\0')
s = DefFlags;
for (;;)
diff --git a/contrib/sendmail/src/udb.c b/contrib/sendmail/src/udb.c
index 1091cf2..b5ca724 100644
--- a/contrib/sendmail/src/udb.c
+++ b/contrib/sendmail/src/udb.c
@@ -14,18 +14,15 @@
#include <sendmail.h>
#if USERDB
-SM_RCSID("@(#)$Id: udb.c,v 8.153 2001/09/11 04:05:17 gshapiro Exp $ (with USERDB)")
+SM_RCSID("@(#)$Id: udb.c,v 8.153.4.4 2002/12/03 17:57:41 gshapiro Exp $ (with USERDB)")
#else /* USERDB */
-SM_RCSID("@(#)$Id: udb.c,v 8.153 2001/09/11 04:05:17 gshapiro Exp $ (without USERDB)")
+SM_RCSID("@(#)$Id: udb.c,v 8.153.4.4 2002/12/03 17:57:41 gshapiro Exp $ (without USERDB)")
#endif /* USERDB */
#if USERDB
# if NEWDB
-# include <db.h>
-# ifndef DB_VERSION_MAJOR
-# define DB_VERSION_MAJOR 1
-# endif /* ! DB_VERSION_MAJOR */
+# include "sm/bdb.h"
# else /* NEWDB */
# define DBT struct _data_base_thang_
DBT
@@ -190,9 +187,9 @@ udbexpand(a, sendq, aliaslevel, e)
int usersize;
int userleft;
char userbuf[MEMCHUNKSIZE];
-# if defined(HESIOD) && defined(HES_GETMAILHOST)
+# if HESIOD && HES_GETMAILHOST
char pobuf[MAXNAME];
-# endif /* defined(HESIOD) && defined(HES_GETMAILHOST) */
+# endif /* HESIOD && HES_GETMAILHOST */
# if defined(NEWDB) && DB_VERSION_MAJOR > 1
DBC *dbc = NULL;
# endif /* defined(NEWDB) && DB_VERSION_MAJOR > 1 */
@@ -996,12 +993,8 @@ _udbx_init(e)
int ret;
# endif /* DB_VERSION_MAJOR > 2 */
-# if !HASFLOCK && defined(DB_FCNTL_LOCKING)
- flags |= DB_FCNTL_LOCKING;
-# endif /* !HASFLOCK && defined(DB_FCNTL_LOCKING) */
-
+ SM_DB_FLAG_ADD(flags);
up->udb_dbp = NULL;
-
# if DB_VERSION_MAJOR > 2
ret = db_create(&up->udb_dbp, NULL, 0);
if (ret != 0)
@@ -1013,6 +1006,7 @@ _udbx_init(e)
else
{
ret = up->udb_dbp->open(up->udb_dbp,
+ DBTXN
up->udb_dbname,
NULL,
DB_BTREE,
diff --git a/contrib/sendmail/src/usersmtp.c b/contrib/sendmail/src/usersmtp.c
index 931e6b3..3a7d54f 100644
--- a/contrib/sendmail/src/usersmtp.c
+++ b/contrib/sendmail/src/usersmtp.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: usersmtp.c,v 8.437.2.5 2002/08/16 16:48:11 ca Exp $")
+SM_RCSID("@(#)$Id: usersmtp.c,v 8.437.2.8 2002/12/12 17:40:07 ca Exp $")
#include <sysexits.h>
@@ -127,6 +127,7 @@ smtpinit(m, mci, e, onlyhelo)
goto helo;
mci->mci_state = MCIS_OPENING;
+ clrsessenvelope(e);
/*
** Get the greeting message.
@@ -222,13 +223,20 @@ tryhelo:
return;
}
-#if !_FFR_DEPRECATE_MAILER_FLAG_I
/*
** If this is expected to be another sendmail, send some internal
** commands.
*/
- if (bitnset(M_INTERNAL, m->m_flags))
+ if (false
+# if !_FFR_DEPRECATE_MAILER_FLAG_I
+ || bitnset(M_INTERNAL, m->m_flags)
+# endif /* !_FFR_DEPRECATE_MAILER_FLAG_I */
+# if _FFR_MSP_VERBOSE
+ /* If we're running as MSP, "propagate" -v flag if possible. */
+ || (UseMSP && Verbose && bitset(MCIF_VERB, mci->mci_flags))
+# endif /* _FFR_MSP_VERBOSE */
+ )
{
/* tell it to be verbose */
smtpmessage("VERB", m, mci);
@@ -236,7 +244,6 @@ tryhelo:
if (r < 0)
goto tempfail1;
}
-#endif /* !_FFR_DEPRECATE_MAILER_FLAG_I */
if (mci->mci_state != MCIS_CLOSED)
{
@@ -453,6 +460,8 @@ helo_options(line, firstline, m, mci, e)
mci->mci_flags |= MCIF_ENHSTAT;
else if (sm_strcasecmp(line, "pipelining") == 0)
mci->mci_flags |= MCIF_PIPELINED;
+ else if (sm_strcasecmp(line, "verb") == 0)
+ mci->mci_flags |= MCIF_VERB;
#if STARTTLS
else if (sm_strcasecmp(line, "starttls") == 0)
mci->mci_flags |= MCIF_TLS;
@@ -2261,7 +2270,7 @@ smtprcpt(to, m, mci, e, ctladdr, xstart)
*/
while (mci->mci_nextaddr != NULL &&
- sm_io_getinfo(mci->mci_in, SM_IO_IS_READABLE, NULL))
+ sm_io_getinfo(mci->mci_in, SM_IO_IS_READABLE, NULL) > 0)
{
int r;
@@ -2668,7 +2677,7 @@ smtpdata(m, mci, e, ctladdr, xstart)
#endif /* PIPELINING */
#if _FFR_CATCH_BROKEN_MTAS
- if (sm_io_getinfo(mci->mci_in, SM_IO_IS_READABLE, NULL))
+ if (sm_io_getinfo(mci->mci_in, SM_IO_IS_READABLE, NULL) > 0)
{
/* terminate the message */
(void) sm_io_fprintf(mci->mci_out, SM_TIME_DEFAULT, ".%s",
diff --git a/contrib/sendmail/src/util.c b/contrib/sendmail/src/util.c
index 52b37ec..27db22f 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.363.2.1 2002/06/21 20:25:25 ca Exp $")
+SM_RCSID("@(#)$Id: util.c,v 8.363.2.5 2002/12/12 22:50:41 ca Exp $")
#include <sysexits.h>
#include <sm/xtrap.h>
@@ -67,6 +67,38 @@ addquotes(s, rpool)
*q = '\0';
return r;
}
+
+#if _FFR_STRIPBACKSL
+/*
+** STRIPBACKSLASH -- Strip leading backslash from a string.
+**
+** This is done in place.
+**
+** Parameters:
+** s -- the string to strip.
+**
+** Returns:
+** none.
+*/
+
+void
+stripbackslash(s)
+ char *s;
+{
+ char *p, *q, c;
+
+ if (s == NULL || *s == '\0')
+ return;
+ p = q = s;
+ while (*p == '\\' && (p[1] == '\\' || (isascii(p[1]) && isalnum(p[1]))))
+ p++;
+ do
+ {
+ c = *q++ = *p++;
+ } while (c != '\0');
+}
+#endif /* _FFR_STRIPBACKSL */
+
/*
** RFC822_STRING -- Checks string for proper RFC822 string quoting.
**
diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c
index 8822333..2be1ca9 100644
--- a/contrib/sendmail/src/version.c
+++ b/contrib/sendmail/src/version.c
@@ -13,6 +13,6 @@
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: version.c,v 8.104.2.5 2002/08/24 16:27:21 ca Exp $")
+SM_RCSID("@(#)$Id: version.c,v 8.104.2.11 2002/12/28 19:45:53 ca Exp $")
-char Version[] = "8.12.6";
+char Version[] = "8.12.7";
OpenPOWER on IntegriCloud