From eae14d029dd0712d71664c39f664d316667a2dc7 Mon Sep 17 00:00:00 2001 From: Scott Savarese Date: Sun, 29 Jul 2018 13:02:49 -0400 Subject: [PATCH] Fix switch to use /etc/postfix/exempt_spf_addresses for skipped relays --- postfix-policyd-spf-perl | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/postfix-policyd-spf-perl b/postfix-policyd-spf-perl index 0e2da49..cb1c47f 100755 --- a/postfix-policyd-spf-perl +++ b/postfix-policyd-spf-perl @@ -255,7 +255,7 @@ sub exempt_localhost { sub get_exempt_address { my ( $file ) = @_; - my $list = {}; + my $list = []; # Return nothing if file not found if ( ! -r $file ) { @@ -270,16 +270,8 @@ sub get_exempt_address { } 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 ) ) { - map( - NetAddr::IP->new($list), - qw( $addr ) - ); + push( @$list, NetAddr::IP->new($addr) ); } return $list; } @@ -290,7 +282,7 @@ sub exempt_relay { if ($attr->{client_address} ne '') { my $client_address = NetAddr::IP->new($attr->{client_address}); 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'; }