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 #!/usr/bin/perl
# mengwong@pobox.com
# Wed Dec 10 03:52:04 EST 2003
# postfix-policyd-spf # postfix-policyd-spf
# version 1.05 # http://www.openspf.org
# see http://spf.pobox.com/ # version 1.06
# $Id$
use Fcntl; use Fcntl;
use Sys::Syslog qw(:DEFAULT setlogsock); use Sys::Syslog qw(:DEFAULT setlogsock);
@ -14,13 +13,13 @@ use strict;
# configuration # 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; my @HANDLERS;
push @HANDLERS, "testing"; push @HANDLERS, "testing";
push @HANDLERS, "sender_permitted_from"; use Mail::SPF::Query; push @HANDLERS, "sender_permitted_from"; use Mail::SPF::Query;
my $VERBOSE = 1; my $VERBOSE = 0;
my $DEFAULT_RESPONSE = "DUNNO"; my $DEFAULT_RESPONSE = "DUNNO";
@ -198,13 +197,9 @@ sub sender_permitted_from {
syslog(info=>"%s: SPF %s: smtp_comment=%s, header_comment=%s", syslog(info=>"%s: SPF %s: smtp_comment=%s, header_comment=%s",
$attr{queue_id}, $result, $smtp_comment, $header_comment); $attr{queue_id}, $result, $smtp_comment, $header_comment);
if ($result eq "pass") { return "DUNNO"; } if ($result eq "fail") { return "REJECT $smtp_comment"; }
elsif ($result eq "fail") { return "REJECT " . ($smtp_comment || $header_comment); } elsif ($result eq "error") { return "DEFER_IF_PERMIT $smtp_comment"; }
elsif ($result eq "error") { return "450 temporary failure: $smtp_comment"; } else { return "PREPEND Received-SPF: $result ($header_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.
} }
# ---------------------------------------------------------- # ----------------------------------------------------------
@ -242,4 +237,3 @@ sub address_stripped {
} }
return $string; return $string;
} }