[svn:qpsmtpd] r697 - branches/0.3x branches/0.3x/plugins

[email protected] Mon, 18 Dec 2006 02:45:25 -0800 (PST)
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
Author: ask
Date: Mon Dec 18 02:45:25 2006
New Revision: 697

Modified:
   /   (props changed)
   branches/0.3x/Changes
   branches/0.3x/plugins/check_badmailfrom

Log:
  Make the badmailfrom plugin support (optional) rejection messages after the
  rejection pattern (Robin Hugh Johnson)



Modified: branches/0.3x/Changes
==============================================================================
--- branches/0.3x/Changes	(original)
+++ branches/0.3x/Changes	Mon Dec 18 02:45:25 2006
@@ -2,6 +2,9 @@
 
   Support "module" plugins ("My::Plugin" in the config/plugins file)
 
+  Make the badmailfrom plugin support (optional) rejection messages after the 
+  rejection pattern (Robin Hugh Johnson)
+
   The ill-named $transaction->body_size() is depreceated now, use 
   $transaction->data_size() instead. Check your logs for LOGWARN messages 
   about "body_size" and fix your plugins. (Hanno Hecker)

Modified: branches/0.3x/plugins/check_badmailfrom
==============================================================================
--- branches/0.3x/plugins/check_badmailfrom	(original)
+++ branches/0.3x/plugins/check_badmailfrom	Mon Dec 18 02:45:25 2006
@@ -1,7 +1,7 @@
 # -*- perl -*-
 =head1 NAME
 
-check_badmailfrom - checks the standard badmailfrom config
+check_badmailfrom - checks the badmailfrom config, with per-line reasons
 
 =head1 DESCRIPTION
 
@@ -13,6 +13,9 @@
 listed in badmailfrom.  A line in badmailfrom may be of the form
 @host, meaning every address at host."
 
+You may optionally include a message after the sender address (leave a space),
+which is used when rejecting the sender.
+
 =head1 NOTES
 
 According to the SMTP protocol, we can't reject until after the RCPT
@@ -33,11 +36,14 @@
   my $from = lc($sender->user) . '@' . $host;
 
   for my $bad (@badmailfrom) {
+    my $reason = $bad;
+    $reason =~ s/^\s*(\S+)[\t\s]+//;
+    $reason = "sorry, your envelope sender is in my badmailfrom list" unless $reason;
     $bad =~ s/^\s*(\S+).*/$1/;
     next unless $bad;
     $bad = lc $bad;
     $self->log(LOGWARN, "Bad badmailfrom config: No \@ sign in $bad") and next unless $bad =~ m/\@/;
-    $transaction->notes('badmailfrom', "sorry, your envelope sender is in my badmailfrom list")
+    $transaction->notes('badmailfrom', $reason)
       if ($bad eq $from) || (substr($bad,0,1) eq '@' && $bad eq "\@$host");
   }
   return (DECLINED);