Skip to content

Commit e9a08f8

Browse files
authored
Merge pull request #1316 from riksoft/riksoft-patch-1
Update SQLBlackWhiteList.pm to allow foo@*.domain.ext
2 parents bff307e + c0669fc commit e9a08f8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

MailScanner_perl_scripts/SQLBlackWhiteList.pm

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@ sub LookupList {
238238

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

241+
# Precompute local part once
242+
my ($localpart) = split /@/, $from;
243+
244+
# Precompute bounce@*.subdomain patterns
245+
my @patterns = map { $localpart . '@' . $_ } @subdomains;
246+
241247
# It is in the list if either the exact address is listed,
242248
# the domain is listed,
243249
# the IP address is listed,
@@ -256,8 +262,9 @@ sub LookupList {
256262
return 1 if $BlackWhite->{$i}{$ip1};
257263
return 1 if $BlackWhite->{$i}{$ip1c};
258264
return 1 if $BlackWhite->{$i}{'default'};
259-
foreach (@subdomains) {
260-
return 1 if $BlackWhite->{$i}{$_};
265+
foreach my $sub (@subdomains) {
266+
return 1 if $BlackWhite->{$i}{$sub}; # *.subdomain
267+
return 1 if $BlackWhite->{$i}{$localpart.'@'.$sub}; # bounce@*.subdomain
261268
}
262269
}
263270

0 commit comments

Comments
 (0)