Index: srvrsmtp.c
===================================================================
RCS file: /cvs/sendmail/srvrsmtp.c,v
retrieving revision 8.957
diff -u -r8.957 srvrsmtp.c
--- srvrsmtp.c	19 Dec 2006 01:15:07 -0000	8.957
+++ srvrsmtp.c	5 Feb 2007 19:25:12 -0000
@@ -621,6 +621,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_rcpt_ok;
 	ADDRESS addr_st;
 # define p_addr_st	&addr_st
 #else /* MILTER */
@@ -2557,6 +2558,8 @@
 #if MILTER
 			(void) memset(&addr_st, '\0', sizeof(addr_st));
 			a = NULL;
+			milter_rcpt_added = false;
+			milter_rcpt_ok = false;
 #endif
 			if (BadRcptThrottle > 0 &&
 			    n_badrcpts >= BadRcptThrottle)
@@ -2611,16 +2614,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 */
@@ -2697,6 +2698,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.... */
@@ -2747,6 +2752,7 @@
 							Errors > 0);
 				milter_cmd_done = true;
 				MILTER_REPLY("to");
+				milter_rcpt_ok = true;
 			}
 #endif /* MILTER */
 
@@ -2821,6 +2827,7 @@
 							true);
 				milter_cmd_done = true;
 				MILTER_REPLY("to");
+				milter_rcpt_ok = true;
 				macdefine(&e->e_macro, A_PERM,
 					macid("{rcpt_mailer}"), NULL);
 				macdefine(&e->e_macro, A_PERM,
@@ -2828,6 +2835,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_rcpt_ok)
+			{
+				(void) removefromlist(addr, &e->e_sendqueue, e);
+				milter_rcpt_ok = true;
+			}
 #endif /* MILTER */
 		    }
 		    SM_END_TRY

