Yahoo Groups archive

Milter-greylist

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

Thread

[milter-greylist] rcpt filter called at non RCPT stage

[milter-greylist] rcpt filter called at non RCPT stage

2007-07-20 by attila.bruncsak@itu.int

Hello,

I wanted to use data stage acl statement with header clause:

dacl blacklist rcpt /@domain\.com[ 	>]*$/ header /^Subject: ADV:/

The milter-greylist4.0a6 has aborted with message:

"rcpt filter called at non RCPT stage"

On the other hand the doc tells the following:

  Note that at DATA stage, the rcpt clause will match if any of the reci-
  pients match the clause. If you want to match an exact set of recipients,
  you can use multiple rcpt clauses along with a rcptcount clause.

That implies the I can use rcpt clause at data stage filtering.
So which one is incorrect: the documentation or the code?

Bests,
Attila

Re: [milter-greylist] rcpt filter called at non RCPT stage

2007-07-20 by manu@netbsd.org

<attila.bruncsak@...> wrote:

> dacl blacklist rcpt /@domain\.com[    >]*$/ header /^Subject: ADV:/
[That breaks, althought the doc says it's okay]
> That implies the I can use rcpt clause at data stage filtering.
> So which one is incorrect: the documentation or the code?

The code, of course. Here is a quick fix (not tested, not even
compiled). Please test it and tell me if it's okay for commit.

Index: acl.c
===================================================================
RCS file: /milter-greylist/milter-greylist/acl.c,v
retrieving revision 1.67
diff -U2 -r1.67 acl.c
--- acl.c       14 Jul 2007 16:03:43 -0000      1.67
+++ acl.c       20 Jul 2007 12:17:08 -0000
@@ -646,11 +646,15 @@
        struct mlfi_priv *priv;
 {
-       if (stage != AS_RCPT) {
-               mg_log(LOG_ERR, "rcpt filter called at non RCPT stage");
-               exit(EX_SOFTWARE);
+       if (stage == AS_RCPT) {
+               if (myregexec(priv, ad, ap, priv->priv_cur_rcpt) == 0)
+                       return 1;
+       } else {
+               struct rcpt *r;
+
+                LIST_FOREACH(r, &priv->priv_rcpt, r_list)
+                       if (myregexec(priv, ad, ap, r->r_addr) == 0)
+                               return 1;
        }
 
-       if (myregexec(priv, ad, ap, priv->priv_cur_rcpt) == 0)
-               return 1;
        return 0;
 }

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu@...

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.