From f28c9429a212c440d5a17e2c8e650aa7573ad1f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ask=20Bj=C3=B8rn=20Hansen?= Date: Tue, 10 Sep 2002 17:17:15 +0000 Subject: [PATCH] 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 --- plugins/check_badmailfrom | 9 +++++++-- plugins/check_badrcptto | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/check_badmailfrom b/plugins/check_badmailfrom index 70e8292..c30cac5 100644 --- a/plugins/check_badmailfrom +++ b/plugins/check_badmailfrom @@ -8,10 +8,15 @@ sub register { sub mail_handler { 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 $from = $sender->user . '@' . $host; - my @badmailfrom = $self->qp->config("badmailfrom"); + for my $bad (@badmailfrom) { $bad =~ s/^\s*(\S+)/$1/; $transaction->notes('badmailfrom', "Mail from $bad not accepted here") diff --git a/plugins/check_badrcptto b/plugins/check_badrcptto index d4ceb03..e65c247 100644 --- a/plugins/check_badrcptto +++ b/plugins/check_badrcptto @@ -7,10 +7,10 @@ sub register { sub check_for_badrcptto { my ($self, $transaction, $recipient) = @_; + my @badrcptto = $self->qp->config("badrcptto") or return (DECLINED); return (DECLINED) unless $recipient->host && $recipient->user; my $host = lc $recipient->host; my $from = $recipient->user . '@' . $host; - my @badrcptto = $self->qp->config("badrcptto"); for my $bad (@badrcptto) { $bad =~ s/^\s*(\S+)/$1/; return (DENY, "mail to $bad not accepted here")