diff --git a/postfix-policyd-spf b/postfix-policyd-spf index 53a93e4..d9240d1 100755 --- a/postfix-policyd-spf +++ b/postfix-policyd-spf @@ -3,7 +3,7 @@ # mengwong@pobox.com # Wed Dec 10 03:52:04 EST 2003 # postfix-policyd-spf -# version 1.03 +# version 1.05 # see http://spf.pobox.com/ use Fcntl; @@ -15,11 +15,10 @@ use strict; # ---------------------------------------------------------- # to use SPF, install Mail::SPF::Query from CPAN or from the SPF website at http://spf.pobox.com/downloads.html -# then uncomment the SPF line. my @HANDLERS; push @HANDLERS, "testing"; -# push @HANDLERS, "sender_permitted_from"; use Mail::SPF::Query; + push @HANDLERS, "sender_permitted_from"; use Mail::SPF::Query; my $VERBOSE = 1; @@ -186,9 +185,14 @@ sub sender_permitted_from { local %_ = @_; my %attr = %{ $_{attr} }; - my $query = new Mail::SPF::Query (ip =>$attr{client_address}, - sender=>$attr{sender}, - helo =>$attr{helo_name}); + my $query = eval { new Mail::SPF::Query (ip =>$attr{client_address}, + sender=>$attr{sender}, + helo =>$attr{helo_name}) }; + if ($@) { + syslog(info=>"%s: Mail::SPF::Query->new(%s, %s, %s) failed: %s", + $attr{queue_id}, $attr{client_address}, $attr{sender}, $attr{helo_name}, $@); + return "DUNNO"; + } my ($result, $smtp_comment, $header_comment) = $query->result(); syslog(info=>"%s: SPF %s: smtp_comment=%s, header_comment=%s",