cvs commit: qpsmtpd/plugins check_badmailfrom
[email protected] (Robert Spier)
| Newsgroups | perl.cvs.qpsmtpd |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 04/11/27 10:40:54
Modified: plugins check_badmailfrom
Log:
Inspired by Justin E@Apache...
- log the fact that badmailfrom is rejecting
- emacs header
- formatting tweak
Revision Changes Path
1.6 +11 -3 qpsmtpd/plugins/check_badmailfrom
Index: check_badmailfrom
===================================================================
RCS file: /cvs/public/qpsmtpd/plugins/check_badmailfrom,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- check_badmailfrom 18 Jun 2004 05:47:45 -0000 1.5
+++ check_badmailfrom 27 Nov 2004 18:40:54 -0000 1.6
@@ -1,3 +1,4 @@
+# -*- perl -*-
=head1 NAME
check_badmailfrom - checks the standard badmailfrom config
@@ -12,6 +13,11 @@
listed in badmailfrom. A line in badmailfrom may be of the form
@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
sub register {
@@ -38,8 +44,7 @@
$bad = lc $bad;
warn "Bad badmailfrom config: No \@ sign in $bad\n" and next unless $bad =~ m/\@/;
$transaction->notes('badmailfrom', "Mail from $bad not accepted here")
- if ($bad eq $from)
- || (substr($bad,0,1) eq '@' && $bad eq "\@$host");
+ if ($bad eq $from) || (substr($bad,0,1) eq '@' && $bad eq "\@$host");
}
return (DECLINED);
}
@@ -47,6 +52,9 @@
sub rcpt_handler {
my ($self, $transaction, $rcpt) = @_;
my $note = $transaction->notes('badmailfrom');
- return (DENY, $note) if $note;
+ if ($note) {
+ $self->log(LOGINFO, $note);
+ return (DENY, $note);
+ }
return (DECLINED);
}