Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions MailScanner_perl_scripts/SQLBlackWhiteList.pm
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ sub LookupList {

# $ip1, $ip2, $ip3 all end in a trailing "."

# Precompute local part once
my ($localpart) = split /@/, $from;

# Precompute bounce@*.subdomain patterns
my @patterns = map { $localpart . '@' . $_ } @subdomains;

# It is in the list if either the exact address is listed,
# the domain is listed,
# the IP address is listed,
Expand All @@ -256,8 +262,9 @@ sub LookupList {
return 1 if $BlackWhite->{$i}{$ip1};
return 1 if $BlackWhite->{$i}{$ip1c};
return 1 if $BlackWhite->{$i}{'default'};
foreach (@subdomains) {
return 1 if $BlackWhite->{$i}{$_};
foreach my $sub (@subdomains) {
return 1 if $BlackWhite->{$i}{$sub}; # *.subdomain
return 1 if $BlackWhite->{$i}{$localpart.'@'.$sub}; # bounce@*.subdomain
}
}

Expand Down