diff -Nabur sendmail-8.12.9.original/include/libmilter/mfapi.h sendmail-8.12.9/include/libmilter/mfapi.h
--- sendmail-8.12.9.original/include/libmilter/mfapi.h	2002-12-19 05:10:09 +0300
+++ sendmail-8.12.9/include/libmilter/mfapi.h	2003-07-31 18:03:14 +0400
@@ -118,7 +118,11 @@
 LIBMILTER_API int smfi_setconn __P((char *));
 LIBMILTER_API int smfi_stop __P((void));
 
+typedef sfsistat (*smfiCallback)(void);
+LIBMILTER_API int smfi_register_hup_handler __P((smfiCallback));
+
 #define SMFI_VERSION	2		/* version number */
+#define SMFI_DRWEB_PATCHED
 
 /*
 **  What the filter might do -- values to be ORed together for
diff -Nabur sendmail-8.12.9.original/libmilter/libmilter.h sendmail-8.12.9/libmilter/libmilter.h
--- sendmail-8.12.9.original/libmilter/libmilter.h	2003-01-04 01:14:40 +0300
+++ sendmail-8.12.9/libmilter/libmilter.h	2003-11-21 15:36:39 +0300
@@ -133,12 +133,6 @@
 # endif /* SOMAXCONN */
 #endif /* ! MI_SOMAXCONN */
 
-/* maximum number of repeated failures in mi_listener() */
-#define MAX_FAILS_M	16	/* malloc() */
-#define MAX_FAILS_T	16	/* thread creation */
-#define MAX_FAILS_A	16	/* accept() */
-#define MAX_FAILS_S	16	/* select() */
-
 /* internal "commands", i.e., error codes */
 #define SMFIC_TIMEOUT	((char) 1)	/* timeout */
 #define SMFIC_SELECT	((char) 2)	/* select error */
@@ -170,6 +164,7 @@
 extern int	mi_listener __P((char *, int, smfiDesc_ptr, time_t, int));
 extern void	mi_clr_macros __P((SMFICTX_PTR, int));
 extern int	mi_stop __P((void));
+extern void mi_set_hup_handler __P((smfiCallback));
 extern int	mi_control_startup __P((char *));
 extern void	mi_stop_milters __P((int));
 extern void	mi_clean_signals __P((void));
diff -Nabur sendmail-8.12.9.original/libmilter/listener.c sendmail-8.12.9/libmilter/listener.c
--- sendmail-8.12.9.original/libmilter/listener.c	2003-01-04 01:14:40 +0300
+++ sendmail-8.12.9/libmilter/listener.c	2003-11-21 15:42:33 +0300
@@ -661,10 +661,6 @@
 	int sockopt = 1;
 	int r;
 	int ret = MI_SUCCESS;
-	int mcnt = 0;	/* error count for malloc() failures */
-	int tcnt = 0;	/* error count for thread_create() failures */
-	int acnt = 0;	/* error count for accept() failures */
-	int scnt = 0;	/* error count for select() failures */
 	int save_errno = 0;
 	sthread_t thread_id;
 	_SOCK_ADDR cliaddr;
@@ -703,17 +699,9 @@
 			(void) smutex_unlock(&L_Mutex);
 			if (save_errno == EINTR)
 				continue;
-			scnt++;
 			smi_log(SMI_LOG_ERR,
-				"%s: select() failed (%s), %s",
-				smfi->xxfi_name, sm_errstring(save_errno),
-				scnt >= MAX_FAILS_S ? "abort" : "try again");
-			MI_SLEEP(scnt);
-			if (scnt >= MAX_FAILS_S)
-			{
-				ret = MI_FAILURE;
-				break;
-			}
+				"%s: select() failed (%s), try again",
+				smfi->xxfi_name, sm_errstring(save_errno) );
 			continue;
 		}
 		if (!FD_IS_RD_RDY(listenfd, rds, excs))
@@ -726,7 +714,6 @@
 				smfi->xxfi_name, MI_POLLSELECT);
 			break;
 		}
-		scnt = 0;	/* reset error counter for select() */
 
 		memset(&cliaddr, '\0', sizeof cliaddr);
 		connfd = accept(listenfd, (struct sockaddr *) &cliaddr,
@@ -766,20 +753,11 @@
 		{
 			if (save_errno == EINTR)
 				continue;
-			acnt++;
 			smi_log(SMI_LOG_ERR,
-				"%s: accept() returned invalid socket (%s), %s",
-				smfi->xxfi_name, sm_errstring(save_errno),
-				acnt >= MAX_FAILS_A ? "abort" : "try again");
-			MI_SLEEP(acnt);
-			if (acnt >= MAX_FAILS_A)
-			{
-				ret = MI_FAILURE;
-				break;
-			}
+				"%s: accept() returned invalid socket (%s), try again",
+				smfi->xxfi_name, sm_errstring(save_errno) );
 			continue;
 		}
-		acnt = 0;	/* reset error counter for accept() */
 
 		if (setsockopt(connfd, SOL_SOCKET, SO_KEEPALIVE,
 				(void *) &sockopt, sizeof sockopt) < 0)
@@ -788,33 +766,20 @@
 				smfi->xxfi_name, sm_errstring(errno));
 			/* XXX: continue? */
 		}
+
 		if ((ctx = (SMFICTX_PTR) malloc(sizeof *ctx)) == NULL)
 		{
 			(void) closesocket(connfd);
-			mcnt++;
-			smi_log(SMI_LOG_ERR, "%s: malloc(ctx) failed (%s), %s",
-				smfi->xxfi_name, sm_errstring(save_errno),
-				mcnt >= MAX_FAILS_M ? "abort" : "try again");
-			MI_SLEEP(mcnt);
-			if (mcnt >= MAX_FAILS_M)
-			{
-				ret = MI_FAILURE;
-				break;
-			}
+			smi_log(SMI_LOG_ERR, "%s: malloc(ctx) failed (%s), try again",
+				smfi->xxfi_name, sm_errstring(save_errno) );
 			continue;
 		}
-		mcnt = 0;	/* reset error counter for malloc() */
+
 		memset(ctx, '\0', sizeof *ctx);
 		ctx->ctx_sd = connfd;
 		ctx->ctx_dbg = dbg;
 		ctx->ctx_timeout = timeout;
 		ctx->ctx_smfi = smfi;
-#if 0
-		if (smfi->xxfi_eoh == NULL)
-		if (smfi->xxfi_eom == NULL)
-		if (smfi->xxfi_abort == NULL)
-		if (smfi->xxfi_close == NULL)
-#endif /* 0 */
 		if (smfi->xxfi_connect == NULL)
 			ctx->ctx_pflags |= SMFIP_NOCONNECT;
 		if (smfi->xxfi_helo == NULL)
@@ -834,22 +799,13 @@
 					mi_thread_handle_wrapper,
 					(void *) ctx)) != 0)
 		{
-			tcnt++;
 			smi_log(SMI_LOG_ERR,
-				"%s: thread_create() failed: %d, %s",
-				smfi->xxfi_name,  r,
-				tcnt >= MAX_FAILS_T ? "abort" : "try again");
-			MI_SLEEP(tcnt);
+				"%s: thread_create() failed: %d, try again",
+				smfi->xxfi_name,  r );
 			(void) closesocket(connfd);
 			free(ctx);
-			if (tcnt >= MAX_FAILS_T)
-			{
-				ret = MI_FAILURE;
-				break;
-			}
 			continue;
 		}
-		tcnt = 0;
 	}
 	if (ret != MI_SUCCESS)
 		mi_stop_milters(MILTER_ABRT);
diff -Nabur sendmail-8.12.9.original/libmilter/main.c sendmail-8.12.9/libmilter/main.c
--- sendmail-8.12.9.original/libmilter/main.c	2003-01-24 01:34:24 +0300
+++ sendmail-8.12.9/libmilter/main.c	2003-07-31 18:07:14 +0400
@@ -69,6 +69,25 @@
 }
 
 /*
+**  SMFI_REGISTER_HUP_HANDLER -- register HUP callback
+**
+**	Parameters:
+**		handler -- callback pointer to post-SIGHUP processing
+**
+**	Returns:
+**		MI_SUCCESS/MI_FAILURE
+*/
+int 
+smfi_register_hup_handler(handler)
+    smfiCallback handler;
+{
+    if (handler == NULL)
+        return MI_FAILURE;
+    mi_set_hup_handler(handler);
+    return MI_SUCCESS;
+}
+
+/*
 **  SMFI_STOP -- stop milter
 **
 **	Parameters:
diff -Nabur sendmail-8.12.9.original/libmilter/signal.c sendmail-8.12.9/libmilter/signal.c
--- sendmail-8.12.9.original/libmilter/signal.c	2002-10-23 20:52:00 +0400
+++ sendmail-8.12.9/libmilter/signal.c	2003-11-21 15:40:46 +0300
@@ -21,6 +21,8 @@
 
 static int MilterStop = MILTER_CONT;
 
+static smfiCallback HUP_Callback = NULL;
+
 /*
 **  MI_STOP -- return value of MilterStop
 **
@@ -73,6 +75,24 @@
 {
 	(void) smutex_destroy(&M_Mutex);
 }
+
+/*
+**  MI_SET_HUP_HANDLER -- register HUP callback function
+**
+**	Parameters:
+**		handler -- callback pointer to post-SIGHUP processing
+**
+**	Returns:
+**		none
+*/
+
+void 
+mi_set_hup_handler(handler)
+    smfiCallback handler;
+{
+    HUP_Callback = handler;
+}
+
 /*
 **  MI_SIGNAL_THREAD -- thread to deal with signals
 **
@@ -87,7 +107,8 @@
 mi_signal_thread(name)
 	void *name;
 {
-	int sig, errs;
+    sfsistat ret;
+	int sig;
 	sigset_t set;
 
 	sigemptyset(&set);
@@ -96,7 +117,6 @@
 
 	/* Handle Ctrl-C gracefully for debugging */
 	sigaddset(&set, SIGINT);
-	errs = 0;
 
 	while (true)
 	{
@@ -113,18 +133,20 @@
 			smi_log(SMI_LOG_ERR,
 				"%s: sigwait returned error: %d",
 				(char *)name, errno);
-			if (++errs > MAX_FAILS_T)
-			{
-				mi_stop_milters(MILTER_ABRT);
-				return NULL;
-			}
 			continue;
 		}
-		errs = 0;
 
 		switch (sig)
 		{
 		  case SIGHUP:
+	    	        if (HUP_Callback)
+                        {
+                            ret = HUP_Callback();
+                            if ((ret == SMFIS_CONTINUE)
+                                || (ret == SMFIS_ACCEPT))
+                                continue;
+                        }
+                        /* fallthru */
 		  case SIGTERM:
 			mi_stop_milters(MILTER_STOP);
 			return NULL;
