postfix-policyd-spf-perl/trunk/postfix-policyd-spf

* Version 1.06.
This commit is contained in:
Julian Mehnle 2006-06-17 16:45:10 +00:00
commit 5e0cd7d9a0

View file

@ -1,10 +1,9 @@
#!/usr/bin/perl
# mengwong@pobox.com
# Wed Dec 10 03:52:04 EST 2003
# postfix-policyd-spf
# version 1.05
# see http://spf.pobox.com/
# http://www.openspf.org
# version 1.06
# $Id$
use Fcntl;
use Sys::Syslog qw(:DEFAULT setlogsock);
@ -14,13 +13,13 @@ use strict;
# configuration
# ----------------------------------------------------------
# to use SPF, install Mail::SPF::Query from CPAN or from the SPF website at http://spf.pobox.com/downloads.html
# to use SPF, install Mail::SPF::Query from CPAN or from the SPF website at http://www.openspf.org/downloads.html
my @HANDLERS;
push @HANDLERS, "testing";
push @HANDLERS, "sender_permitted_from"; use Mail::SPF::Query;
my $VERBOSE = 1;
my $VERBOSE = 0;
my $DEFAULT_RESPONSE = "DUNNO";
@ -198,13 +197,9 @@ sub sender_permitted_from {
syslog(info=>"%s: SPF %s: smtp_comment=%s, header_comment=%s",
$attr{queue_id}, $result, $smtp_comment, $header_comment);
if ($result eq "pass") { return "DUNNO"; }
elsif ($result eq "fail") { return "REJECT " . ($smtp_comment || $header_comment); }
elsif ($result eq "error") { return "450 temporary failure: $smtp_comment"; }
else { return "DUNNO"; }
# unknown, softfail, neutral and none all return DUNNO
# TODO XXX: prepend Received-SPF header. Wietse says he will add that functionality soon.
if ($result eq "fail") { return "REJECT $smtp_comment"; }
elsif ($result eq "error") { return "DEFER_IF_PERMIT $smtp_comment"; }
else { return "PREPEND Received-SPF: $result ($header_comment)"; }
}
# ----------------------------------------------------------
@ -242,4 +237,3 @@ sub address_stripped {
}
return $string;
}