Perform checks on MAIL-FROM and RCPT-TO case insensitively.

git-svn-id: https://svn.perl.org/qpsmtpd/trunk@248 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Devin Carraway 2004-06-18 05:47:45 +00:00
parent 8d07a36fcc
commit 4f2f9889d0
2 changed files with 4 additions and 2 deletions

View File

@ -30,11 +30,12 @@ sub mail_handler {
and $sender->host && $sender->user); and $sender->host && $sender->user);
my $host = lc $sender->host; my $host = lc $sender->host;
my $from = $sender->user . '@' . $host; my $from = lc($sender->user) . '@' . $host;
for my $bad (@badmailfrom) { for my $bad (@badmailfrom) {
$bad =~ s/^\s*(\S+).*/$1/; $bad =~ s/^\s*(\S+).*/$1/;
next unless $bad; next unless $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)

View File

@ -10,8 +10,9 @@ sub check_for_badrcptto {
my @badrcptto = $self->qp->config("badrcptto") or return (DECLINED); 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 = lc($recipient->user) . '@' . $host;
for my $bad (@badrcptto) { for my $bad (@badrcptto) {
$bad = lc $bad;
$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")
if $bad eq $from; if $bad eq $from;