fix default reason handling

Tomas Lee <j533xdbjwfgdbsv@jetable.net> pointed out that
cab7466c08 broke the default badmailfrom
reason.

This fixes that functionality and simplifies the code a little.
This commit is contained in:
Robert 2009-06-22 22:44:38 -07:00
parent 7efee7b1af
commit 6345b62e82

View File

@ -36,11 +36,9 @@ sub hook_mail {
my $host = lc $sender->host; my $host = lc $sender->host;
my $from = lc($sender->user) . '@' . $host; my $from = lc($sender->user) . '@' . $host;
for my $bad (@badmailfrom) { for my $config (@badmailfrom) {
my $reason = $bad; my ($bad, $reason) = $config =~ /^\s*(\S+)(?:\s*(.*)\s*)?$/;
$reason =~ s/^\s*(\S+)[\t\s]+//;
$reason = "sorry, your envelope sender is in my badmailfrom list" unless $reason; $reason = "sorry, your envelope sender is in my badmailfrom list" unless $reason;
$bad =~ s/^\s*(\S+).*/$1/;
next unless $bad; next unless $bad;
$bad = lc $bad; $bad = lc $bad;
$self->log(LOGWARN, "Bad badmailfrom config: No \@ sign in $bad") and next unless $bad =~ m/\@/; $self->log(LOGWARN, "Bad badmailfrom config: No \@ sign in $bad") and next unless $bad =~ m/\@/;