Inspired by Justin E@Apache...

- log the fact that badmailfrom is rejecting
- emacs header
- formatting tweak


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@352 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Robert Spier 2004-11-27 18:40:54 +00:00
parent 3757913d54
commit 9422b16c0f

View File

@ -1,3 +1,4 @@
# -*- perl -*-
=head1 NAME =head1 NAME
check_badmailfrom - checks the standard badmailfrom config check_badmailfrom - checks the standard badmailfrom config
@ -12,6 +13,11 @@ recipient address for a message if the envelope sender address is
listed in badmailfrom. A line in badmailfrom may be of the form listed in badmailfrom. A line in badmailfrom may be of the form
@host, meaning every address at host." @host, meaning every address at host."
=head1 NOTES
According to the SMTP protocol, we can't reject until after the RCPT
stage, so store it until later.
=cut =cut
sub register { sub register {
@ -38,8 +44,7 @@ sub mail_handler {
$bad = lc $bad; $bad = lc $bad;
warn "Bad badmailfrom config: No \@ sign in $bad\n" and next unless $bad =~ m/\@/; warn "Bad badmailfrom config: No \@ sign in $bad\n" and next unless $bad =~ m/\@/;
$transaction->notes('badmailfrom', "Mail from $bad not accepted here") $transaction->notes('badmailfrom', "Mail from $bad not accepted here")
if ($bad eq $from) if ($bad eq $from) || (substr($bad,0,1) eq '@' && $bad eq "\@$host");
|| (substr($bad,0,1) eq '@' && $bad eq "\@$host");
} }
return (DECLINED); return (DECLINED);
} }
@ -47,6 +52,9 @@ sub mail_handler {
sub rcpt_handler { sub rcpt_handler {
my ($self, $transaction, $rcpt) = @_; my ($self, $transaction, $rcpt) = @_;
my $note = $transaction->notes('badmailfrom'); my $note = $transaction->notes('badmailfrom');
return (DENY, $note) if $note; if ($note) {
$self->log(LOGINFO, $note);
return (DENY, $note);
}
return (DECLINED); return (DECLINED);
} }