[milters] Archive

Lists Index Date Thread Search

Article: 1111
From: Rich Graves
Date: 2006-08-23 16:05:27 -0400
Subject: milter-spamc greylist if not in AWL

Removal...........: milters-request@milter.info?subject=remove
More information..: http://www.milter.info/#Support
--------------------------------------------------------

Reimplementing an idea from http://www.ehsco.com/misc/sagrey/

If threshold < score < threshold+extra-reject *and* the spamd report did 
not contain an AWL line (i.e., this is the first message we have ever 
received from this mail-from/netblock tuple), then tempfail the message. 
A compromise for people like me who find full greylisting to be too 
strict, but want to avoid delivering likely-spam messages from throwaway 
addresses.

There's a lot of ways one could imagine combining greylisting and 
spamassassin; this is just one.

--- milter-spamc.c.awl-grey   2006-08-23 14:07:10.000000000 -0400
+++ milter-spamc.c     2006-08-23 15:24:02.000000000 -0400
@@ -797,7 +799,7 @@
        ParsePath *rcpt;
        int i, length, iscore;
        float score, threshold;
-       const char *if_name, *if_addr, *is_spam;
+       const char *if_name, *if_addr, *is_spam, *is_awl;
 
        if ((data = (workspace) smfi_getpriv(ctx)) == NULL)
                return smfNullWorkspaceError("filterEndMessage");
@@ -942,6 +944,7 @@
                }
        }
 #endif
+       is_awl = smfNo;
        /* Collect report lines until read error or EOF. */
        while (0 <= (length = readline(data, data->line, 
SMTP_TEXT_LINE_LENGTH))) {
                /* Remove trailing whitespace. */
@@ -960,6 +963,9 @@
                                                *s = 'p';
                                }
                                (void) VectorAdd(data->report, 
strdup(data->line));
+                               if (is_spam == smfYes && 
TextMatch(data->line,"AWL: From: address is in the auto white-list",-1,0)) {
+                                       is_awl = smfYes;
+                               }
                        }
 #endif
                        BufAddString(data->headers, data->line);
@@ -1104,6 +1110,9 @@
                        return SMFIS_DISCARD;
                if (threshold + optExtraReject.value <= score)
                        return SMFIS_REJECT;
+               if (is_awl == smfNo) {
+                       return smfMultiLineReplyA(&data->work, 450, 
"4.7.1", "identified as possible junk mail, try again, score
%.2f/%.2f", 
score, threshold);
+               }
        }
 error0:
        return SMFIS_CONTINUE;


Lists Index Date Thread Search