changeset 3966:7aaa946a7259

6542343 upgrade sendmail to 8.14.1
author jbeck
date Wed, 04 Apr 2007 16:59:29 -0700
parents b92c333acf86
children 390705455279
files usr/src/cmd/sendmail/cf/README usr/src/cmd/sendmail/cf/m4/proto.m4 usr/src/cmd/sendmail/cf/m4/version.m4 usr/src/cmd/sendmail/include/libmilter/mfdef.h usr/src/cmd/sendmail/include/sm/conf.h usr/src/cmd/sendmail/include/sm/errstring.h usr/src/cmd/sendmail/lib/helpfile usr/src/cmd/sendmail/libmilter/engine.c usr/src/cmd/sendmail/libsm/config.c usr/src/cmd/sendmail/libsm/memstat.c usr/src/cmd/sendmail/libsm/t-memstat.c usr/src/cmd/sendmail/libsm/t-sem.c usr/src/cmd/sendmail/src/conf.c usr/src/cmd/sendmail/src/daemon.c usr/src/cmd/sendmail/src/deliver.c usr/src/cmd/sendmail/src/headers.c usr/src/cmd/sendmail/src/map.c usr/src/cmd/sendmail/src/milter.c usr/src/cmd/sendmail/src/queue.c usr/src/cmd/sendmail/src/recipient.c usr/src/cmd/sendmail/src/sendmail.h usr/src/cmd/sendmail/src/srvrsmtp.c usr/src/cmd/sendmail/src/version.c
diffstat 23 files changed, 313 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/sendmail/cf/README	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/cf/README	Wed Apr 04 16:59:29 2007 -0700
@@ -1100,7 +1100,7 @@
 		found in a DNS based list.  The first argument is used as
 		the domain in which blocked hosts are listed.  A second
 		argument can be used to change the default error message,
-		or select one of the operations `discard' and 'quarantine'.
+		or select one of the operations `discard' and `quarantine'.
 		Without that second argument, the error message will be
 
 			Rejected: IP-ADDRESS listed at SERVER
@@ -1340,9 +1340,20 @@
 block_bad_helo	Reject messages from SMTP clients which provide a HELO/EHLO
 		argument which is either unqualified, or is one of our own
 		names (i.e., the server name instead of the client name).
+		This check is performed at RCPT stage and disabled for the
+		following cases:
+		- authenticated sessions,
+		- connections from IP addresses in class $={R}.
+		Currently access_db lookups can not be used to
+		(selectively) disable this test, moreover,
+		FEATURE(`delay_checks')
+		is required.
 
 require_rdns	Reject mail from connecting SMTP clients without proper
 		rDNS (reverse DNS), functional gethostbyaddr() resolution.
+		Note: this feature will cause false positives, i.e., there
+		are legitimate MTAs that do not have proper DNS entries.
+		Rejecting mails from those MTAs is a local policy decision.
 
 		The basic policy is to reject message with a 5xx error if
 		the IP address fails to resolve.  However, if this is a
@@ -3791,6 +3802,11 @@
 					"double bounce" error message to this
 					address.  If it expands to an empty
 					string, double bounces are dropped.
+confSOFT_BOUNCE		SoftBounce	[False] If set, issue temporary errors
+					(4xy) instead of permanent errors
+					(5xy).  This can be useful during
+					testing of a new configuration to
+					avoid erroneous bouncing of mails.
 confDEAD_LETTER_DROP	DeadLetterDrop	[undefined] Filename to save bounce
 					messages which could not be returned
 					to the user or sent to postmaster.
@@ -3969,7 +3985,14 @@
 					milters after RCPT TO command.
 confMILTER_MACROS_EOM		Milter.macros.eom
 					[{msg_id}] Macros to transmit to
-					milters after DATA command.
+					milters after the terminating
+					DATA '.' is received.
+confMILTER_MACROS_EOH		Milter.macros.eoh
+					Macros to transmit to milters
+					after the end of headers.
+confMILTER_MACROS_DATA		Milter.macros.data
+					Macros to transmit to milters
+					after DATA command is received.
 
 
 See also the description of OSTYPE for some parameters that can be
@@ -4283,5 +4306,5 @@
    8	DNS based blacklists
    9	special local rulesets (1 and 2)
 
-$Revision: 8.716 $, Last updated $Date: 2007/01/08 18:32:25 $
+$Revision: 8.722 $, Last updated $Date: 2007/04/03 21:26:58 $
 ident	"%Z%%M%	%I%	%E% SMI"
--- a/usr/src/cmd/sendmail/cf/m4/proto.m4	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/cf/m4/proto.m4	Wed Apr 04 16:59:29 2007 -0700
@@ -1,6 +1,6 @@
 divert(-1)
 #
-# Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+# Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
 #	All rights reserved.
 # Copyright (c) 1983, 1995 Eric P. Allman.  All rights reserved.
 # Copyright (c) 1988, 1993
@@ -18,7 +18,7 @@
 #
 divert(0)
 
-VERSIONID(`$Id: proto.m4,v 8.726 2007/01/04 18:27:46 ca Exp $')
+VERSIONID(`$Id: proto.m4,v 8.730 2007/02/01 18:50:03 ca Exp $')
 
 # level CF_LEVEL config file format
 V`'CF_LEVEL/ifdef(`VENDOR_NAME', `VENDOR_NAME', `Sun')
@@ -569,6 +569,9 @@
 # where do errors that occur when sending errors get sent?
 _OPTION(DoubleBounceAddress, `confDOUBLE_BOUNCE_ADDRESS', `postmaster')
 
+# issue temporary errors (4xy) instead of permanent errors (5xy)?
+_OPTION(SoftBounce, `confSOFT_BOUNCE', `False')
+
 # where to save bounces if all else fails
 _OPTION(DeadLetterDrop, `confDEAD_LETTER_DROP', `/var/tmp/dead.letter')
 
@@ -652,7 +655,9 @@
 _OPTION(Milter.macros.helo, `confMILTER_MACROS_HELO', `')
 _OPTION(Milter.macros.envfrom, `confMILTER_MACROS_ENVFROM', `')
 _OPTION(Milter.macros.envrcpt, `confMILTER_MACROS_ENVRCPT', `')
-_OPTION(Milter.macros.eom, `confMILTER_MACROS_EOM', `')')
+_OPTION(Milter.macros.eom, `confMILTER_MACROS_EOM', `')
+_OPTION(Milter.macros.eoh, `confMILTER_MACROS_EOH', `')
+_OPTION(Milter.macros.data, `confMILTER_MACROS_DATA', `')')
 
 # CA directory
 _OPTION(CACertPath, `confCACERT_PATH', `')
--- a/usr/src/cmd/sendmail/cf/m4/version.m4	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/cf/m4/version.m4	Wed Apr 04 16:59:29 2007 -0700
@@ -12,8 +12,8 @@
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-VERSIONID(`$Id: version.m4,v 8.169 2007/01/31 19:00:43 ca Exp $')
+VERSIONID(`$Id: version.m4,v 8.178 2007/04/03 21:21:18 ca Exp $')
 #
 divert(0)
 # Configuration version number
-DZ8.14.0`'ifdef(`confCF_VERSION', `/confCF_VERSION')
+DZ8.14.1`'ifdef(`confCF_VERSION', `/confCF_VERSION')
--- a/usr/src/cmd/sendmail/include/libmilter/mfdef.h	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/include/libmilter/mfdef.h	Wed Apr 04 16:59:29 2007 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2007 Sendmail, Inc. and its suppliers.
  *	All rights reserved.
  *
  * By using this file, you agree to the terms and conditions set
@@ -7,7 +7,7 @@
  * the sendmail distribution.
  *
  *
- *	$Id: mfdef.h,v 8.36 2006/11/28 18:31:00 ca Exp $
+ *	$Id: mfdef.h,v 8.38 2007/03/27 18:53:48 ca Exp $
  */
 
 /*
@@ -36,7 +36,7 @@
 /* These apply to SMFIF_* flags */
 #define	SMFI_V1_ACTS	0x0000000FL	/* The actions of V1 filter */
 #define	SMFI_V2_ACTS	0x0000003FL	/* The actions of V2 filter */
-#define	SMFI_CURR_ACTS	0x000000FFL	/* actions of current version */
+#define	SMFI_CURR_ACTS	0x000001FFL	/* actions of current version */
 
 /* address families */
 #define	SMFIA_UNKNOWN		'U'	/* unknown */
--- a/usr/src/cmd/sendmail/include/sm/conf.h	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/include/sm/conf.h	Wed Apr 04 16:59:29 2007 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
  *	All rights reserved.
  * Copyright (c) 1983, 1995-1997 Eric P. Allman.  All rights reserved.
  * Copyright (c) 1988, 1993
@@ -10,7 +10,7 @@
  * the sendmail distribution.
  *
  *
- *	$Id: conf.h,v 1.130 2006/08/17 21:15:07 ca Exp $
+ *	$Id: conf.h,v 1.132 2007/03/21 23:56:18 ca Exp $
  */
 
 /*
@@ -169,6 +169,8 @@
 */
 
 # ifdef _AIX5
+#  include <sys/signal.h>
+#  include <sys/wait.h>
 #  define _AIX4		40300
 #  define SOCKADDR_LEN_T socklen_t /* e.g., arg#3 to accept, getsockname */
 #  define SOCKOPT_LEN_T	socklen_t /* arg#5 to getsockopt */
@@ -862,36 +864,64 @@
 # endif /* __bsdi__ */
 
 
+# if defined(__QNX__)
+#  if defined(__QNXNTO__)
+/* QNX 6 */
+#   include <unix.h>
+#   define HASUNSETENV	1	/* has unsetenv(3) call */
+#   define HASINITGROUPS	1	/* has initgroups(3) call */
+#   define HASSETSID	1	/* has POSIX setsid(2) call */
+#   define USESETEUID	1	/* has usable seteuid(2) call */
+#   define HASFCHMOD	1	/* has fchmod(2) syscall */
+#   define HASFCHOWN	1	/* has fchown(2) syscall */
+#   define HASUNAME	1	/* has uname(2) syscall */
+#   define HASSTRERROR	1	/* has strerror(3) */
+#   define BSD4_4_SOCKADDR	/* has sa_len */
+#   define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
+#   define NETLINK	1	/* supports AF_LINK */
+#   define GIDSET_T	gid_t
+#   define QUAD_T	uint64_t
+#   define HASSNPRINTF	1	/* has snprintf(3) (all versions?) */
+#   define HASGETUSERSHELL 0
+
+/*
+**  We have a strrev() that doesn't allocate anything.
+**  Make sure the one here is used.
+*/
+
+#   define strrev strrev_sendmail
+
+#  else /* defined(__QNXNTO__) */
+
 /*
 **  QNX 4.2x
 **	Contributed by Glen McCready <glen@qnx.com>.
 **
-**	Should work with all versions of QNX.
+**	Should work with all versions of QNX 4.
 */
 
-# if defined(__QNX__)
-#  include <unix.h>
-#  include <sys/select.h>
-#  undef NGROUPS_MAX
-#  define HASSETSID	1	/* has POSIX setsid(2) call */
-#  define USESETEUID	1	/* has usable seteuid(2) call */
-#  define HASFCHMOD	1	/* has fchmod(2) syscall */
-#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
-#  define HASSETREUID	1	/* has setreuid(2) call */
-#  define HASSTRERROR	1	/* has strerror(3) */
-#  define HASFLOCK	0
-#  undef HASINITGROUPS		/* has initgroups(3) call */
-#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
-#  define IP_SRCROUTE	1	/* can check IP source routing */
-#  define TZ_TYPE	TZ_TMNAME	/* use tmname variable */
-#  define GIDSET_T	gid_t
-#  define LA_TYPE	LA_ZERO
-#  define SFS_TYPE	SFS_NONE
-#  define SPT_TYPE	SPT_REUSEARGV
-#  define SPT_PADCHAR	'\0'	/* pad process title with nulls */
-#  define HASGETUSERSHELL 0
-#  define E_PSEUDOBASE	512
-#  define _FILE_H_INCLUDED
+#   include <unix.h>
+#   include <sys/select.h>
+#   undef NGROUPS_MAX
+#   define HASSETSID	1	/* has POSIX setsid(2) call */
+#   define USESETEUID	1	/* has usable seteuid(2) call */
+#   define HASFCHMOD	1	/* has fchmod(2) syscall */
+#   define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
+#   define HASSETREUID	1	/* has setreuid(2) call */
+#   define HASSTRERROR	1	/* has strerror(3) */
+#   define HASFLOCK	0
+#   undef HASINITGROUPS		/* has initgroups(3) call */
+#   define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
+#   define IP_SRCROUTE	1	/* can check IP source routing */
+#   define TZ_TYPE	TZ_TMNAME	/* use tmname variable */
+#   define GIDSET_T	gid_t
+#   define LA_TYPE	LA_ZERO
+#   define SFS_TYPE	SFS_NONE
+#   define SPT_TYPE	SPT_REUSEARGV
+#   define SPT_PADCHAR	'\0'	/* pad process title with nulls */
+#   define HASGETUSERSHELL 0
+#   define _FILE_H_INCLUDED
+#  endif /* defined(__QNXNTO__) */
 # endif /* defined(__QNX__) */
 
 
--- a/usr/src/cmd/sendmail/include/sm/errstring.h	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/include/sm/errstring.h	Wed Apr 04 16:59:29 2007 -0700
@@ -6,7 +6,7 @@
  * forth in the LICENSE file which can be found at the top level of
  * the sendmail distribution.
  *
- *	$Id: errstring.h,v 1.9 2003/12/10 03:19:06 gshapiro Exp $
+ *	$Id: errstring.h,v 1.10 2007/03/21 23:56:19 ca Exp $
  */
 
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -18,6 +18,10 @@
 #ifndef SM_ERRSTRING_H
 # define SM_ERRSTRING_H
 
+#if defined(__QNX__)
+# define E_PSEUDOBASE	512
+#endif /* defined(__QNX__) */
+
 #include <errno.h>
 #if NEEDINTERRNO
 extern int errno;
--- a/usr/src/cmd/sendmail/lib/helpfile	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/lib/helpfile	Wed Apr 04 16:59:29 2007 -0700
@@ -1,16 +1,16 @@
 #vers	2
 cpyr
-cpyr	Copyright (c) 1998-2000, 2002, 2004-2006 Sendmail, Inc. and its suppliers.
+cpyr	Copyright (c) 1998-2000, 2002, 2004-2007 Sendmail, Inc. and its suppliers.
 cpyr	    All rights reserved.
 cpyr	Copyright (c) 1983, 1995-1997 Eric P. Allman.  All rights reserved.
 cpyr	Copyright (c) 1988, 1993
 cpyr	    The Regents of the University of California.  All rights reserved.
-cpyr	Copyright 1994-2006 Sun Microsystems, Inc.  All rights reserved.
+cpyr	Copyright 1994-2007 Sun Microsystems, Inc.  All rights reserved.
 cpyr	Use is subject to license terms.
 cpyr
 cpyr
 cpyr	ident	"%Z%%M%	%I%	%E% SMI"
-cpyr	$$Id: helpfile,v 8.47 2006/04/26 18:22:54 ca Exp $$
+cpyr	$$Id: helpfile,v 8.48 2007/02/01 18:29:44 ca Exp $$
 cpyr
 smtp	This is sendmail version $v
 smtp	Topics:
@@ -128,4 +128,5 @@
 control	restart		Restart sendmail.
 control	shutdown	Shutdown sendmail.
 control	status		Show sendmail status.
+control	mstat		Show sendmail status (machine readable format).
 control	memdump		Dump allocated memory list (for debugging only).
--- a/usr/src/cmd/sendmail/libmilter/engine.c	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/libmilter/engine.c	Wed Apr 04 16:59:29 2007 -0700
@@ -11,7 +11,7 @@
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include <sm/gen.h>
-SM_RCSID("@(#)$Id: engine.c,v 8.155 2006/12/19 22:18:55 ca Exp $")
+SM_RCSID("@(#)$Id: engine.c,v 8.157 2007/03/26 18:10:04 ca Exp $")
 
 #include "libmilter.h"
 
@@ -736,6 +736,7 @@
 **	Returns:
 **		None.
 */
+
 void
 mi_clr_macros(ctx, m)
 	SMFICTX_PTR ctx;
@@ -1192,6 +1193,7 @@
 **	Returns:
 **		continue or filter-specified value
 */
+
 static int
 st_helo(g)
 	genarg *g;
@@ -1211,6 +1213,7 @@
 	}
 	return SMFIS_CONTINUE;
 }
+
 /*
 **  ST_HEADER -- header line
 **
@@ -1308,7 +1311,6 @@
 
 	if (g == NULL)
 		return _SMFIS_ABORT;
-	mi_clr_macros(g->a_ctx, g->a_idx + 1);
 	if (g->a_ctx->ctx_smfi != NULL &&
 	    (fi_unknown = g->a_ctx->ctx_smfi->xxfi_unknown) != NULL)
 		return (*fi_unknown)(g->a_ctx, (const char *) g->a_buf);
@@ -1374,6 +1376,7 @@
 	g->a_ctx->ctx_mac_buf[i] = g->a_buf;
 	return _SMFIS_KEEP;
 }
+
 /*
 **  ST_QUIT -- quit command
 **
@@ -1399,6 +1402,7 @@
 	mi_clr_macros(g->a_ctx, 0);
 	return _SMFIS_NOREPLY;
 }
+
 /*
 **  ST_BODYCHUNK -- deal with a piece of the mail body
 **
@@ -1423,6 +1427,7 @@
 				  g->a_len);
 	return SMFIS_CONTINUE;
 }
+
 /*
 **  ST_BODYEND -- deal with the last piece of the mail body
 **
@@ -1470,6 +1475,7 @@
 		return (*fi_eom)(g->a_ctx);
 	return r;
 }
+
 /*
 **  ST_ABORTFCT -- deal with aborts
 **
@@ -1493,6 +1499,7 @@
 		(void) (*fi_abort)(g->a_ctx);
 	return _SMFIS_NOREPLY;
 }
+
 /*
 **  TRANS_OK -- is the state transition ok?
 **
@@ -1542,6 +1549,7 @@
 	} while (s < SIZE_NEXT_STATES);
 	return false;
 }
+
 /*
 **  FIX_STM -- add "skip" bits to the state transition table
 **
@@ -1634,6 +1642,7 @@
 	s[elem] = NULL;
 	return s;
 }
+
 /*
 **  DEC_ARG2 -- split a buffer into two strings
 **
@@ -1666,6 +1675,7 @@
 	*s2 = buf + i + 1;
 	return MI_SUCCESS;
 }
+
 /*
 **  SENDOK -- is it ok for the filter to send stuff to the MTA?
 **
--- a/usr/src/cmd/sendmail/libsm/config.c	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/libsm/config.c	Wed Apr 04 16:59:29 2007 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2003 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2000-2003, 2007 Sendmail, Inc. and its suppliers.
  *	All rights reserved.
  *
  * By using this file, you agree to the terms and conditions set
@@ -11,7 +11,7 @@
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include <sm/gen.h>
-SM_RCSID("@(#)$Id: config.c,v 1.30 2003/12/10 03:19:07 gshapiro Exp $")
+SM_RCSID("@(#)$Id: config.c,v 1.31 2007/03/14 21:21:49 ca Exp $")
 
 #include <stdlib.h>
 #include <sm/heap.h>
@@ -249,5 +249,14 @@
 #if SM_VA_STD
 	"SM_VA_STD",
 #endif /* SM_VA_STD */
+#if USEKSTAT
+	"USEKSTAT",
+#endif /* USEKSTAT */
+#if USEPROCMEMINFO
+	"USEPROCMEMINFO",
+#endif /* USEPROCMEMINFO */
+#if USESWAPCTL
+	"USESWAPCTL",
+#endif /* USESWAPCTL */
 	NULL
 };
--- a/usr/src/cmd/sendmail/libsm/memstat.c	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/libsm/memstat.c	Wed Apr 04 16:59:29 2007 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2005-2007 Sendmail, Inc. and its suppliers.
  *      All rights reserved.
  *
  * By using this file, you agree to the terms and conditions set
@@ -10,7 +10,7 @@
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include <sm/gen.h>
-SM_RCSID("@(#)$Id: memstat.c,v 1.5 2006/06/28 23:57:59 ca Exp $")
+SM_RCSID("@(#)$Id: memstat.c,v 1.6 2007/03/20 23:26:12 ca Exp $")
 
 #include <errno.h>
 #include <sm/misc.h>
@@ -268,6 +268,8 @@
 		return -1;	/* try to reopen? */
 	rewind(fp);
 	l = strlen(resource);
+	if (l >= sizeof(buf))
+		return EINVAL;
 	while (fgets(buf, sizeof(buf), fp) != NULL)
 	{
 		if (strncmp(buf, resource, l) == 0 && buf[l] == ':')
--- a/usr/src/cmd/sendmail/libsm/t-memstat.c	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/libsm/t-memstat.c	Wed Apr 04 16:59:29 2007 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2005-2007 Sendmail, Inc. and its suppliers.
  *      All rights reserved.
  *
  * By using this file, you agree to the terms and conditions set
@@ -10,7 +10,7 @@
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include <sm/gen.h>
-SM_IDSTR(id, "@(#)$Id: t-memstat.c,v 1.7 2006/06/28 23:57:59 ca Exp $")
+SM_IDSTR(id, "@(#)$Id: t-memstat.c,v 1.9 2007/03/14 21:41:09 ca Exp $")
 
 #include <sm/misc.h>
 
@@ -27,6 +27,18 @@
 extern char *optarg;
 extern int optind;
 
+void
+usage(prg)
+	char *prg;
+{
+	fprintf(stderr, "usage: %s [options]\n", prg);
+	fprintf(stderr, "options:\n");
+	fprintf(stderr, "-l n    loop n times\n");
+	fprintf(stderr, "-m n    allocate n bytes per iteration\n");
+	fprintf(stderr, "-r name use name as resource to query\n");
+	fprintf(stderr, "-s n    sleep n seconds per iteration\n");
+}
+
 int
 main(argc, argv)
 	int argc;
@@ -60,7 +72,8 @@
 			break;
 
 		  default:
-			break;
+			usage(argv[0]);
+			exit(1);
 		}
 	}
 
--- a/usr/src/cmd/sendmail/libsm/t-sem.c	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/libsm/t-sem.c	Wed Apr 04 16:59:29 2007 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2001, 2005-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2000-2001, 2005-2007 Sendmail, Inc. and its suppliers.
  *      All rights reserved.
  *
  * By using this file, you agree to the terms and conditions set
@@ -10,7 +10,7 @@
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include <sm/gen.h>
-SM_RCSID("@(#)$Id: t-sem.c,v 1.15 2006/03/13 20:40:43 msk Exp $")
+SM_RCSID("@(#)$Id: t-sem.c,v 1.16 2007/03/21 23:22:10 ca Exp $")
 
 #include <stdio.h>
 
@@ -24,6 +24,8 @@
 # include <sm/test.h>
 # include <sm/sem.h>
 
+# define T_SM_SEM_KEY (4321L)
+
 static void
 delay(t, s)
 	int t;
@@ -60,7 +62,7 @@
 	int semid;
 	int t;
 
-	semid = sm_sem_start(SM_SEM_KEY, SM_NSEM, 0, owner);
+	semid = sm_sem_start(T_SM_SEM_KEY, SM_NSEM, 0, owner);
 	if (semid < 0)
 	{
 		perror("sm_sem_start failed");
@@ -147,7 +149,7 @@
 	int semid, r;
 	int cnt = 0;
 
-	semid = sm_sem_start(SM_SEM_KEY, 1, 0, owner);
+	semid = sm_sem_start(T_SM_SEM_KEY, 1, 0, owner);
 	if (semid < 0)
 	{
 		perror("sm_sem_start failed");
--- a/usr/src/cmd/sendmail/src/conf.c	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/src/conf.c	Wed Apr 04 16:59:29 2007 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
  *	All rights reserved.
  * Copyright (c) 1983, 1995-1997 Eric P. Allman.  All rights reserved.
  * Copyright (c) 1988, 1993
@@ -20,7 +20,7 @@
 
 #include <sendmail.h>
 
-SM_RCSID("@(#)$Id: conf.c,v 8.1119 2006/12/19 00:58:56 ca Exp $")
+SM_RCSID("@(#)$Id: conf.c,v 8.1128 2007/04/03 21:32:29 ca Exp $")
 SM_IDSTR(i2, "%W% (Sun) %G%")
 
 #include <sm/sendmail.h>
@@ -1303,7 +1303,7 @@
 	/* keep gethostby*() from stripping the local domain name */
 	set_domain_trim_off();
 #endif /* _CONVEX_SOURCE */
-#ifdef __QNX__
+#if defined(__QNX__) && !defined(__QNXNTO__)
 	/*
 	**  Due to QNX's network distributed nature, you can target a tcpip
 	**  stack on a different node in the qnx network; this patch lets
@@ -3893,11 +3893,8 @@
 	ENVELOPE *e;
 {
 #ifdef __QNX__
-	char *p;
-
 	/* Makes sure the SOCK environment variable remains */
-	if (p = getextenv("SOCK"))
-		sm_setuserenv("SOCK", p);
+	sm_setuserenv("SOCK", NULL);
 #endif /* __QNX__ */
 #if defined(SUN_EXTENSIONS) && defined(SUN_DEFAULT_VALUES)
 	sun_post_defaults(e);
@@ -6090,6 +6087,21 @@
 	/* Allow usernames with '.' */
 	"_FFR_DOTTED_USERNAMES",
 #endif /* _FFR_DOTTED_USERNAMES */
+#if _FFR_DPO_CS
+	/*
+	**  Make DaemonPortOptions case sensitive.
+	**  For some unknown reasons the code converted every option
+	**  to uppercase (first letter only, as that's the only one that
+	**  is actually checked). This prevented all new lower case options
+	**  from working...
+	**  The documentation doesn't say anything about case (in)sensitivity,
+	**  which means it should be case sensitive by default,
+	**  but it's not a good idea to change this within a patch release,
+	**  so let's delay this to 8.15.
+	*/
+
+	"_FFR_DPO_CS",
+#endif /* _FFR_DPO_CS */
 #if _FFR_DROP_TRUSTUSER_WARNING
 	/*
 	**  Don't issue this warning:
@@ -6185,6 +6197,9 @@
 	/* Check free memory */
 	"_FFR_MEMSTAT",
 #endif /* _FFR_MEMSTAT */
+#if _FFR_MILTER_CHECK
+	"_FFR_MILTER_CHECK",
+#endif /* _FFR_MILTER_CHECK */
 #if _FFR_MILTER_CONVERT_ALL_LF_TO_CRLF
 	/*
 	**  milter_body() uses the same conversion algorithm as putbody()
@@ -6203,6 +6218,14 @@
 
 	"_FFR_MILTER_CONVERT_ALL_LF_TO_CRLF",
 #endif /* _FFR_MILTER_CONVERT_ALL_LF_TO_CRLF */
+#if _FFR_MILTER_CHECK_REJECTIONS_TOO
+	/*
+	**  Also send RCPTs that are rejected by check_rcpt to a milter
+	**  (if requested during option negotiation).
+	*/
+
+	"_FFR_MILTER_CHECK_REJECTIONS_TOO",
+#endif /* _FFR_MILTER_CHECK_REJECTIONS_TOO */
 #if _FFR_MIME7TO8_OLD
 	/* Old mime7to8 code, the new is broken for at least one example. */
 	"_FFR_MIME7TO8_OLD",
@@ -6224,6 +6247,9 @@
 	/* log ntries=, from Nik Clayton of FreeBSD */
 	"_FFR_LOG_NTRIES",
 #endif /* _FFR_LOG_NTRIES */
+#if _FFR_QF_PARANOIA
+	"_FFR_QF_PARANOIA",
+#endif /* _FFR_QF_PARANOIA */
 #if _FFR_QUEUEDELAY
 	/* Exponential queue delay; disabled in 8.13 since it isn't used. */
 	"_FFR_QUEUEDELAY",
--- a/usr/src/cmd/sendmail/src/daemon.c	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/src/daemon.c	Wed Apr 04 16:59:29 2007 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
  *	All rights reserved.
  * Copyright (c) 1983, 1995-1997 Eric P. Allman.  All rights reserved.
  * Copyright (c) 1988, 1993
@@ -16,7 +16,7 @@
 #include <sendmail.h>
 #include "map.h"
 
-SM_RCSID("@(#)$Id: daemon.c,v 8.676 2006/12/19 01:15:06 ca Exp $")
+SM_RCSID("@(#)$Id: daemon.c,v 8.678 2007/03/08 00:33:40 ca Exp $")
 
 #if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__)
 # define USE_SOCK_STREAM	1
@@ -1470,12 +1470,13 @@
 			continue;
 		while (isascii(*++v) && isspace(*v))
 			continue;
-		if (isascii(*f) && islower(*f))
-			*f = toupper(*f);
 
 		switch (*f)
 		{
 		  case 'A':		/* address */
+#if !_FFR_DPO_CS
+		  case 'a':
+#endif /* !_FFR_DPO_CS */
 			addr = v;
 			break;
 
@@ -1504,6 +1505,9 @@
 			break;
 
 		  case 'F':		/* address family */
+#if !_FFR_DPO_CS
+		  case 'f':
+#endif /* !_FFR_DPO_CS */
 			if (isascii(*v) && isdigit(*v))
 				d->d_addr.sa.sa_family = atoi(v);
 #if _FFR_DAEMON_NETUNIX
@@ -1540,23 +1544,38 @@
 
 #if MILTER
 		  case 'I':
+# if !_FFR_DPO_CS
+		  case 'i':
+# endif /* !_FFR_DPO_CS */
 			d->d_inputfilterlist = v;
 			break;
 #endif /* MILTER */
 
 		  case 'L':		/* listen queue size */
+#if !_FFR_DPO_CS
+		  case 'l':
+#endif /* !_FFR_DPO_CS */
 			d->d_listenqueue = atoi(v);
 			break;
 
 		  case 'M':		/* modifiers (flags) */
+#if !_FFR_DPO_CS
+		  case 'm':
+#endif /* !_FFR_DPO_CS */
 			d->d_mflags = getmodifiers(v, d->d_flags);
 			break;
 
 		  case 'N':		/* name */
+#if !_FFR_DPO_CS
+		  case 'n':
+#endif /* !_FFR_DPO_CS */
 			d->d_name = v;
 			break;
 
 		  case 'P':		/* port */
+#if !_FFR_DPO_CS
+		  case 'p':
+#endif /* !_FFR_DPO_CS */
 			port = v;
 			break;
 
@@ -1573,6 +1592,9 @@
 			break;
 
 		  case 'S':		/* send buffer size */
+#if !_FFR_DPO_CS
+		  case 's':
+#endif /* !_FFR_DPO_CS */
 			d->d_tcpsndbufsize = atoi(v);
 			break;
 
--- a/usr/src/cmd/sendmail/src/deliver.c	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/src/deliver.c	Wed Apr 04 16:59:29 2007 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
  *	All rights reserved.
  * Copyright (c) 1983, 1995-1997 Eric P. Allman.  All rights reserved.
  * Copyright (c) 1988, 1993
@@ -16,7 +16,7 @@
 #include <sendmail.h>
 #include <sm/time.h>
 
-SM_RCSID("@(#)$Id: deliver.c,v 8.1010 2006/12/19 01:15:06 ca Exp $")
+SM_RCSID("@(#)$Id: deliver.c,v 8.1012 2007/03/29 21:20:15 ca Exp $")
 
 #if HASSETUSERCONTEXT
 # include <login_cap.h>
@@ -1336,11 +1336,13 @@
 	char cbuf[MAXPATHLEN];
 
 	errno = 0;
+	SM_REQUIRE(firstto != NULL);	/* same as to */
 	if (!QS_IS_OK(to->q_state))
 		return 0;
 
 	suidwarn = geteuid() == 0;
 
+	SM_REQUIRE(e != NULL);
 	m = to->q_mailer;
 	host = to->q_host;
 	CurEnv = e;			/* just in case */
@@ -1385,6 +1387,7 @@
 
 	/* rewrite from address, using rewriting rules */
 	rcode = EX_OK;
+	SM_ASSERT(e->e_from.q_mailer != NULL);
 	if (bitnset(M_UDBENVELOPE, e->e_from.q_mailer->m_flags))
 		p = e->e_sender;
 	else
@@ -3087,6 +3090,16 @@
 				(void) sm_strlcpy(SmtpError, p,
 						  sizeof(SmtpError));
 			}
+			else if (mci->mci_state == MCIS_CLOSED)
+			{
+				/* connection close caused by 421 */
+				mci->mci_errno = 0;
+				rcode = EX_TEMPFAIL;
+				mci_setstat(mci, rcode, NULL, "421");
+			}
+			else
+				rcode = 0;
+
 			QuickAbort = saveQuickAbort;
 			SuprErrs = saveSuprErrs;
 			if (DONE_STARTTLS(mci->mci_flags) &&
--- a/usr/src/cmd/sendmail/src/headers.c	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/src/headers.c	Wed Apr 04 16:59:29 2007 -0700
@@ -16,7 +16,7 @@
 #include <sendmail.h>
 #include <sm/sendmail.h>
 
-SM_RCSID("@(#)$Id: headers.c,v 8.309 2007/01/08 23:53:25 ca Exp $")
+SM_RCSID("@(#)$Id: headers.c,v 8.310 2007/02/07 22:44:35 ca Exp $")
 
 static HDR	*allocheader __P((char *, char *, int, SM_RPOOL_T *, bool));
 static size_t	fix_mime_header __P((HDR *, ENVELOPE *));
@@ -851,7 +851,8 @@
 				sm_dprintf(") ");
 			}
 			expand(h->h_value, buf, sizeof(buf), e);
-			if (buf[0] != '\0')
+			if (buf[0] != '\0' &&
+			    (buf[0] != ' ' || buf[1] != '\0'))
 			{
 				if (bitset(H_FROM, h->h_flags))
 					expand(crackaddr(buf, e),
--- a/usr/src/cmd/sendmail/src/map.c	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/src/map.c	Wed Apr 04 16:59:29 2007 -0700
@@ -20,7 +20,7 @@
 
 #include <sendmail.h>
 
-SM_RCSID("@(#)$Id: map.c,v 8.693 2006/12/19 00:58:56 ca Exp $")
+SM_RCSID("@(#)$Id: map.c,v 8.696 2007/04/03 21:33:14 ca Exp $")
 SM_IDSTR(i2, "%W% (Sun) %G%")
 
 #if LDAPMAP
@@ -4706,7 +4706,7 @@
 /*
 **  Support for the CCSO Nameserver (ph/qi).
 **  This code is intended to replace the so-called "ph mailer".
-**  Contributed by Mark D. Roth <roth@uiuc.edu>.  Contact him for support.
+**  Contributed by Mark D. Roth.  Contact him for support.
 */
 
 /* what version of the ph map code we're running */
--- a/usr/src/cmd/sendmail/src/milter.c	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/src/milter.c	Wed Apr 04 16:59:29 2007 -0700
@@ -12,7 +12,7 @@
 
 #include <sendmail.h>
 
-SM_RCSID("@(#)$Id: milter.c,v 8.266 2006/11/29 00:20:41 ca Exp $")
+SM_RCSID("@(#)$Id: milter.c,v 8.267 2007/02/27 22:21:12 ca Exp $")
 
 #if MILTER
 # include <sm/sendmail.h>
@@ -1244,11 +1244,11 @@
 	m->mf_timeout[SMFTO_WRITE] = (time_t) 10;
 	m->mf_timeout[SMFTO_READ] = (time_t) 10;
 	m->mf_timeout[SMFTO_EOM] = (time_t) 300;
-#if MILTER_CHECK
+#if _FFR_MILTER_CHECK
 	m->mf_mta_prot_version = SMFI_PROT_VERSION;
 	m->mf_mta_prot_flags = SMFI_CURR_PROT;
 	m->mf_mta_actions = SMFI_CURR_ACTS;
-#endif /* MILTER_CHECK */
+#endif /* _FFR_MILTER_CHECK */
 
 	/* now scan through and assign info from the fields */
 	while (*p != '\0')
@@ -1296,7 +1296,7 @@
 			milter_parse_timeouts(p, m);
 			break;
 
-#if MILTER_CHECK
+#if _FFR_MILTER_CHECK
 		  case 'a':
 			m->mf_mta_actions = strtoul(p, NULL, 0);
 			break;
@@ -1306,7 +1306,7 @@
 		  case 'v':
 			m->mf_mta_prot_version = strtoul(p, NULL, 0);
 			break;
-#endif /* MILTER_CHECK */
+#endif /* _FFR_MILTER_CHECK */
 
 		  default:
 			syserr("X%s: unknown filter equate %c=",
@@ -2436,15 +2436,15 @@
 		return -1;
 	}
 
-#if MILTER_CHECK
+#if _FFR_MILTER_CHECK
 	mta_prot_vers = m->mf_mta_prot_version;
 	mta_prot_flags = m->mf_mta_prot_flags;
 	mta_actions = m->mf_mta_actions;
-#else /* MILTER_CHECK */
+#else /* _FFR_MILTER_CHECK */
 	mta_prot_vers = SMFI_PROT_VERSION;
 	mta_prot_flags = SMFI_CURR_PROT;
 	mta_actions = SMFI_CURR_ACTS;
-#endif /* MILTER_CHECK */
+#endif /* _FFR_MILTER_CHECK */
 
 	fvers = htonl(mta_prot_vers);
 	pflags = htonl(mta_prot_flags);
--- a/usr/src/cmd/sendmail/src/queue.c	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/src/queue.c	Wed Apr 04 16:59:29 2007 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
  *	All rights reserved.
  * Copyright (c) 1983, 1995-1997 Eric P. Allman.  All rights reserved.
  * Copyright (c) 1988, 1993
@@ -16,7 +16,7 @@
 #include <sendmail.h>
 #include <sm/sem.h>
 
-SM_RCSID("@(#)$Id: queue.c,v 8.970 2006/12/19 01:15:07 ca Exp $")
+SM_RCSID("@(#)$Id: queue.c,v 8.972 2007/03/29 22:55:17 ca Exp $")
 
 #include <dirent.h>
 
@@ -798,6 +798,8 @@
 			(void) expand(h->h_value, buf, sizeof(buf), e);
 			if (buf[0] == '\0')
 				continue;
+			if (buf[0] == ' ' && buf[1] == '\0')
+				continue;
 		}
 
 		/* output this header */
@@ -3912,6 +3914,7 @@
 	**  Read and process the file.
 	*/
 
+	SM_REQUIRE(e != NULL);
 	bp = NULL;
 	(void) sm_strlcpy(qf, queuename(e, ANYQFL_LETTER), sizeof(qf));
 	qfp = sm_io_open(SmFtStdio, SM_TIME_DEFAULT, qf, SM_IO_RDWR_B, NULL);
@@ -4505,6 +4508,17 @@
 		(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)
+	{
+		syserr("readqf: %s: sender not specified in queue file", qf);
+		(void) sm_io_close(qfp, SM_TIME_DEFAULT);
+		return false;
+	}
+	/* other checks? */
+#endif /* _FFR_QF_PARANOIA */
 
 	/* possibly set ${dsn_ret} macro */
 	if (bitset(EF_RET_PARAM, e->e_flags))
--- a/usr/src/cmd/sendmail/src/recipient.c	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/src/recipient.c	Wed Apr 04 16:59:29 2007 -0700
@@ -15,7 +15,7 @@
 
 #include <sendmail.h>
 
-SM_RCSID("@(#)$Id: recipient.c,v 8.344 2007/02/01 05:12:14 ca Exp $")
+SM_RCSID("@(#)$Id: recipient.c,v 8.348 2007/03/19 21:33:09 ca Exp $")
 
 static void	includetimeout __P((int));
 static ADDRESS	*self_reference __P((ADDRESS *));
@@ -429,8 +429,7 @@
 
 /*
 **  RECIPIENT -- Designate a message recipient
-**
-**	Saves the named person for future mailing.
+**	Saves the named person for future mailing (after some checks).
 **
 **	Parameters:
 **		new -- the (preparsed) address header for the recipient.
@@ -1878,12 +1877,16 @@
 		sm_dprintf("include: read error: %s\n", sm_errstring(errno));
 	if (nincludes > 0 && !bitset(QSELFREF, ctladdr->q_flags))
 	{
-		if (tTd(27, 5))
+		if (aliaslevel <= MaxAliasRecursion ||
+		    ctladdr->q_state != QS_BADADDR)
 		{
-			sm_dprintf("include: QS_DONTSEND ");
-			printaddr(sm_debug_file(), ctladdr, false);
+			ctladdr->q_state = QS_DONTSEND;
+			if (tTd(27, 5))
+			{
+				sm_dprintf("include: QS_DONTSEND ");
+				printaddr(sm_debug_file(), ctladdr, false);
+			}
 		}
-		ctladdr->q_state = QS_DONTSEND;
 	}
 
 	(void) sm_io_close(fp, SM_TIME_DEFAULT);
--- a/usr/src/cmd/sendmail/src/sendmail.h	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/src/sendmail.h	Wed Apr 04 16:59:29 2007 -0700
@@ -54,7 +54,7 @@
 
 #ifdef _DEFINE
 # ifndef lint
-SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1040 2006/12/19 19:47:38 ca Exp $";
+SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1042 2007/02/27 22:21:13 ca Exp $";
 # endif /* ! lint */
 #endif /* _DEFINE */
 
@@ -1630,7 +1630,7 @@
 #define PRIV_NORECEIPTS		0x00200000	/* disallow return receipts */
 #define PRIV_NOACTUALRECIPIENT	0x00400000 /* no X-Actual-Recipient in DSNs */
 
-/* don't give no info, anyway, anyhow */
+/* don't give no info, anyway, anyhow (in the main SMTP transaction) */
 #define PRIV_GOAWAY		0x0000ffff
 
 /* struct defining such things */
@@ -1719,12 +1719,12 @@
 	int		mf_sock;	/* connected socket */
 	char		mf_state;	/* state of filter */
 	time_t		mf_timeout[SMFTO_NUM_TO]; /* timeouts */
-#if MILTER_CHECK
+#if _FFR_MILTER_CHECK
 	/* for testing only */
 	mi_int32	mf_mta_prot_version;
 	mi_int32	mf_mta_prot_flags;
 	mi_int32	mf_mta_actions;
-#endif /* MILTER_CHECK */
+#endif /* _FFR_MILTER_CHECK */
 };
 
 /* MTA flags */
--- a/usr/src/cmd/sendmail/src/srvrsmtp.c	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/src/srvrsmtp.c	Wed Apr 04 16:59:29 2007 -0700
@@ -19,7 +19,7 @@
 # include <libmilter/mfdef.h>
 #endif /* MILTER */
 
-SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.957 2006/12/19 01:15:07 ca Exp $")
+SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.960 2007/02/07 20:18:47 ca Exp $")
 
 #include <sm/time.h>
 #include <sm/fdset.h>
@@ -372,6 +372,7 @@
 	{								\
 		int savelogusrerrs = LogUsrErrs;			\
 									\
+		milter_cmd_fail = true;					\
 		switch (state)						\
 		{							\
 		  case SMFIR_SHUTDOWN:					\
@@ -432,6 +433,7 @@
 					  "Milter: %s=%s, discard",	\
 					  str, addr);			\
 			e->e_flags |= EF_DISCARD;			\
+			milter_cmd_fail = false;			\
 			break;						\
 									\
 		  case SMFIR_TEMPFAIL:					\
@@ -444,6 +446,9 @@
 			}						\
 			usrerr(MSG_TEMPFAIL);				\
 			break;						\
+		  default:						\
+			milter_cmd_fail = false;			\
+			break;						\
 		}							\
 		LogUsrErrs = savelogusrerrs;				\
 		if (response != NULL)					\
@@ -623,6 +628,7 @@
 	volatile time_t log_delay = (time_t) 0;
 #if MILTER
 	volatile bool milter_cmd_done, milter_cmd_safe;
+	volatile bool milter_rcpt_added, milter_cmd_fail;
 	ADDRESS addr_st;
 # define p_addr_st	&addr_st
 #else /* MILTER */
@@ -1141,6 +1147,9 @@
 		LogUsrErrs = false;
 		OnlyOneError = true;
 		e->e_flags &= ~(EF_VRFYONLY|EF_GLOBALERRS);
+#if MILTER
+		milter_cmd_fail = false;
+#endif /* MILTER */
 
 		/* setup for the read */
 		e->e_to = NULL;
@@ -2495,6 +2504,7 @@
 #if MILTER
 			(void) memset(&addr_st, '\0', sizeof(addr_st));
 			a = NULL;
+			milter_rcpt_added = false;
 #endif
 			if (BadRcptThrottle > 0 &&
 			    n_badrcpts >= BadRcptThrottle)
@@ -2549,16 +2559,14 @@
 
 #if MILTER
 			/*
-			**  If the filter will be deleting recipients,
-			**  don't expand them at RCPT time (in the call
+			**  Do not expand recipients at RCPT time (in the call
 			**  to recipient()).  If they are expanded, it
 			**  is impossible for removefromlist() to figure
 			**  out the expanded members of the original
 			**  recipient and mark them as QS_DONTSEND.
 			*/
 
-			if (milter_can_delrcpts())
-				e->e_flags |= EF_VRFYONLY;
+			e->e_flags |= EF_VRFYONLY;
 			milter_cmd_done = false;
 			milter_cmd_safe = false;
 #endif /* MILTER */
@@ -2613,6 +2621,23 @@
 			if (Errors > 0)
 				goto rcpt_done;
 
+#if MILTER
+			/*
+			**  rscheck() can trigger an "exception"
+			**  in which case the execution continues at
+			**  SM_EXCEPT(exc, "[!F]*")
+			**  This means milter_cmd_safe is not set
+			**  and hence milter is not invoked.
+			**  Would it be "safe" to change that, i.e., use
+			**  milter_cmd_safe = true;
+			**  here so a milter is informed (if requested)
+			**  about RCPTs that are rejected by check_rcpt?
+			*/
+# if _FFR_MILTER_CHECK_REJECTIONS_TOO
+			milter_cmd_safe = true;
+# endif
+#endif
+
 			/* do config file checking of the recipient */
 			macdefine(&e->e_macro, A_PERM,
 				macid("{addr_type}"), "e r");
@@ -2635,6 +2660,10 @@
 			a = recipient(a, &e->e_sendqueue, 0, e);
 			/* may trigger exception... */
 
+#if MILTER
+			milter_rcpt_added = true;
+#endif
+
 			if(!(Errors > 0) && QS_IS_BADADDR(a->q_state))
 			{
 				/* punt -- should keep message in ADDRESS.... */
@@ -2766,6 +2795,13 @@
 				macdefine(&e->e_macro, A_PERM,
 					macid("{rcpt_addr}"), NULL);
 			}
+			if (smtp.sm_milterlist && smtp.sm_milterize &&
+			    milter_rcpt_added && milter_cmd_done &&
+			    milter_cmd_fail)
+			{
+				(void) removefromlist(addr, &e->e_sendqueue, e);
+				milter_cmd_fail = false;
+			}
 #endif /* MILTER */
 		    }
 		    SM_END_TRY
--- a/usr/src/cmd/sendmail/src/version.c	Tue Apr 03 15:35:46 2007 -0700
+++ b/usr/src/cmd/sendmail/src/version.c	Wed Apr 04 16:59:29 2007 -0700
@@ -15,6 +15,6 @@
 
 #include <sm/gen.h>
 
-SM_RCSID("@(#)$Id: version.c,v 8.182 2007/01/31 19:00:43 ca Exp $")
+SM_RCSID("@(#)$Id: version.c,v 8.191 2007/04/03 21:21:18 ca Exp $")
 
-char	Version[] = "8.14.0+Sun";
+char	Version[] = "8.14.1+Sun";