Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Message

unbreak 'rcptcount'

2008-07-27 by Constantine A. Murenin

Hello, 

Currently, priv_rcptcount variable is only used for comparison against the 
'rcptcount' settings specified by the user, and not to store the count 
of 'accepted' rcpt entries in the priv_rcpt list structure.

% fgrep priv_rcptcount *
acl.c:	if (acl_opnum_cmp(priv->priv_rcptcount, ad->opnum.op, ad->opnum.num))
milter-greylist.c:	priv->priv_rcptcount = 0;
milter-greylist.c:	priv->priv_rcptcount++;
milter-greylist.h:	int priv_rcptcount;

However, priv_rcptcount is only incremented in add_recipient(), 
which is only called from real_envrcpt() upon an "exit_accept:" 
condition.

Battlefield experience shows that my 'rcptcount' 'flushaddr' rules are 
successfully bypassed, contributing to an increased greylist.db, and 
I think that this logic is to blame.

The patch below is supposed to address this behaviour, although it 
hasn't been tested in production as of yet.  Does it look all right?

Cheers,
Constantine A. Murenin,
University of Waterloo.

Index: milter-greylist.c
===================================================================
RCS file: /milter-greylist/milter-greylist/milter-greylist.c,v
retrieving revision 1.202
diff -u -d -p -4 -r1.202 milter-greylist.c
--- milter-greylist.c	29 Dec 2007 19:06:49 -0000	1.202
+++ milter-greylist.c	27 Jul 2008 21:58:47 -0000
@@ -496,8 +496,9 @@ real_envrcpt(ctx, envrcpt)
 	if ((priv = (struct mlfi_priv *) smfi_getpriv(ctx)) == NULL) {
 		mg_log(LOG_ERR, "Internal error: smfi_getpriv() returns NULL");
 		return SMFIS_TEMPFAIL;
 	}
+	priv->priv_rcptcount++;
 
 	if (!iptostring(SA(&priv->priv_addr), priv->priv_addrlen, addrstr,
 	    sizeof(addrstr)))
 		goto exit_accept;
@@ -1989,9 +1990,8 @@ add_recipient(priv, rcpt)
 	strncpy(nr->r_addr, rcpt, sizeof(nr->r_addr));
 	nr->r_addr[ADDRLEN] = '\0';
 
 	LIST_INSERT_HEAD(&priv->priv_rcpt, nr, r_list);
-	priv->priv_rcptcount++;
 	return;
 }
 
 static void

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.