Fix switch to use /etc/postfix/exempt_spf_addresses for skipped relays

This commit is contained in:
Scott Savarese 2018-07-29 13:02:49 -04:00 committed by Scott Kitterman
commit eae14d029d

View file

@ -255,7 +255,7 @@ sub exempt_localhost {
sub get_exempt_address { sub get_exempt_address {
my ( $file ) = @_; my ( $file ) = @_;
my $list = {}; my $list = [];
# Return nothing if file not found # Return nothing if file not found
if ( ! -r $file ) { if ( ! -r $file ) {
@ -270,16 +270,8 @@ sub get_exempt_address {
} }
close( FILE ); close( FILE );
#$list => map(
# NetAddr::IP->new($_),
# qw( $text )
#); # add addresses to qw ( ) above separated by spaces using CIDR notation.
foreach my $addr ( split( /[\s,]+/, $text ) ) { foreach my $addr ( split( /[\s,]+/, $text ) ) {
map( push( @$list, NetAddr::IP->new($addr) );
NetAddr::IP->new($list),
qw( $addr )
);
} }
return $list; return $list;
} }
@ -290,7 +282,7 @@ sub exempt_relay {
if ($attr->{client_address} ne '') { if ($attr->{client_address} ne '') {
my $client_address = NetAddr::IP->new($attr->{client_address}); my $client_address = NetAddr::IP->new($attr->{client_address});
return "PREPEND Authentication-Results: $host; none (SPF not checked for whitelisted relay)" return "PREPEND Authentication-Results: $host; none (SPF not checked for whitelisted relay)"
if grep($_->contains($client_address), relay_addresses); if grep($_->contains($client_address), @$relay_addresses);
}; };
return 'DUNNO'; return 'DUNNO';
} }