This patch changes the deny_late option so the greylisting plugin will wait
to check and update it's database until later.  The problem I noticed was
that greylisting was filling up it's database with hosts that were later
denied by dnsbl.  Similarly if the host is allowed by dns_whitelist_soft
then the greylisting plugin will now ignore it

-- 
  Matthew Harrell                          Welcome to All Things Unix,
  Bit Twiddlers, Inc.                       where if it's not Unix,
  [EMAIL PROTECTED]                 it's CRAP!
--- greylisting.bck	2007-08-17 12:28:10.000000000 -0400
+++ greylisting	2007-08-23 10:00:24.000000000 -0400
@@ -159,11 +159,17 @@
 
 sub mail_handler {
   my ($self, $transaction, $sender) = @_;
-  my ($status, $msg) = $self->denysoft_greylist($transaction, $sender, undef);
-  if ($status == DENYSOFT) {
-    my $config = $self->{_greylist_config};
-    return DENYSOFT, $msg unless $config->{deny_late};
-    $transaction->notes('denysoft_greylist', $msg) 
+  my $config = $self->{_greylist_config};
+
+  if ( $config->{deny_late} ) {
+    $transaction->notes('denysoft_greylist', $sender) 
+
+  } else {
+    my ($status, $msg) = $self->denysoft_greylist($transaction, $sender, undef);
+
+    if ($status == DENYSOFT) {
+      return DENYSOFT, $msg;
+    }
   }
   return DECLINED;
 }
@@ -186,14 +192,20 @@
 
 sub hook_data {
   my ($self, $transaction) = @_;
-  my $note = $transaction->notes('denysoft_greylist');
-  return DECLINED unless $note;
+  my $sender = $transaction->notes('denysoft_greylist');
+  return DECLINED unless $sender;
   # Decline if ALL recipients are whitelisted
   if (($transaction->notes('whitelistrcpt')||0) == scalar($transaction->recipients)) {
     # $self->log(LOGWARN,"all recipients whitelisted - skipping");
     return DECLINED;
   }
-  return DENYSOFT, $note;
+
+  my ($status, $msg) = $self->denysoft_greylist($transaction, $sender, undef);
+
+  if ($status == DENYSOFT) {
+    return DENYSOFT, $msg;
+  }
+  return DECLINED;
 }
 
 sub denysoft_greylist {

Reply via email to