From c0669fc6a478defe66f9051f447adba66d06e7f5 Mon Sep 17 00:00:00 2001 From: Rik Date: Thu, 18 Sep 2025 09:56:36 +0100 Subject: [PATCH] Update SQLBlackWhiteList.pm *.spammer.com it's great, but with this little modification it also allows to set a less broader rule like this one foo@*.spammer.com Why it's useful? For example info@random1.domain.com is OK info@random2.domain.com is OK info@random3.domain.com is OK ads@random1.domain.com is bad ads@random2.domain.com is bad Can be BL as: ads@*.domain.com --- MailScanner_perl_scripts/SQLBlackWhiteList.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/MailScanner_perl_scripts/SQLBlackWhiteList.pm b/MailScanner_perl_scripts/SQLBlackWhiteList.pm index a2fddf6e..38e4ff94 100644 --- a/MailScanner_perl_scripts/SQLBlackWhiteList.pm +++ b/MailScanner_perl_scripts/SQLBlackWhiteList.pm @@ -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, @@ -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 } }