skip as much work as possibly if we are not configured to do any.
fix bug that gave a warning for <> senders in check_badmailfrom git-svn-id: https://svn.perl.org/qpsmtpd/trunk@73 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
21a88f9f54
commit
f28c9429a2
@ -8,10 +8,15 @@ sub register {
|
|||||||
|
|
||||||
sub mail_handler {
|
sub mail_handler {
|
||||||
my ($self, $transaction, $sender) = @_;
|
my ($self, $transaction, $sender) = @_;
|
||||||
return (DECLINED) unless $sender->host && $sender->user;
|
my @badmailfrom = $self->qp->config("badmailfrom")
|
||||||
|
or return (DECLINED);
|
||||||
|
|
||||||
|
return (DECLINED) unless ($sender->format ne "<>"
|
||||||
|
and $sender->host && $sender->user);
|
||||||
|
|
||||||
my $host = lc $sender->host;
|
my $host = lc $sender->host;
|
||||||
my $from = $sender->user . '@' . $host;
|
my $from = $sender->user . '@' . $host;
|
||||||
my @badmailfrom = $self->qp->config("badmailfrom");
|
|
||||||
for my $bad (@badmailfrom) {
|
for my $bad (@badmailfrom) {
|
||||||
$bad =~ s/^\s*(\S+)/$1/;
|
$bad =~ s/^\s*(\S+)/$1/;
|
||||||
$transaction->notes('badmailfrom', "Mail from $bad not accepted here")
|
$transaction->notes('badmailfrom', "Mail from $bad not accepted here")
|
||||||
|
@ -7,10 +7,10 @@ sub register {
|
|||||||
|
|
||||||
sub check_for_badrcptto {
|
sub check_for_badrcptto {
|
||||||
my ($self, $transaction, $recipient) = @_;
|
my ($self, $transaction, $recipient) = @_;
|
||||||
|
my @badrcptto = $self->qp->config("badrcptto") or return (DECLINED);
|
||||||
return (DECLINED) unless $recipient->host && $recipient->user;
|
return (DECLINED) unless $recipient->host && $recipient->user;
|
||||||
my $host = lc $recipient->host;
|
my $host = lc $recipient->host;
|
||||||
my $from = $recipient->user . '@' . $host;
|
my $from = $recipient->user . '@' . $host;
|
||||||
my @badrcptto = $self->qp->config("badrcptto");
|
|
||||||
for my $bad (@badrcptto) {
|
for my $bad (@badrcptto) {
|
||||||
$bad =~ s/^\s*(\S+)/$1/;
|
$bad =~ s/^\s*(\S+)/$1/;
|
||||||
return (DENY, "mail to $bad not accepted here")
|
return (DENY, "mail to $bad not accepted here")
|
||||||
|
Loading…
Reference in New Issue
Block a user