From 6345b62e82ef68e6d8b9afb011401e935f06ee0e Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 22 Jun 2009 22:44:38 -0700 Subject: [PATCH] fix default reason handling Tomas Lee pointed out that cab7466c08fec71c48cba5a77beee08ec3b190a4 broke the default badmailfrom reason. This fixes that functionality and simplifies the code a little. --- plugins/check_badmailfrom | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/check_badmailfrom b/plugins/check_badmailfrom index 0638997..1b502e4 100644 --- a/plugins/check_badmailfrom +++ b/plugins/check_badmailfrom @@ -36,11 +36,9 @@ sub hook_mail { my $host = lc $sender->host; my $from = lc($sender->user) . '@' . $host; - for my $bad (@badmailfrom) { - my $reason = $bad; - $reason =~ s/^\s*(\S+)[\t\s]+//; + for my $config (@badmailfrom) { + my ($bad, $reason) = $config =~ /^\s*(\S+)(?:\s*(.*)\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/\@/;