postfix-policyd-spf-perl/trunk/postfix-policyd-spf
* Version 1.07.
This commit is contained in:
parent
5e0cd7d9a0
commit
0bd77bdc15
1 changed files with 14 additions and 15 deletions
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
# postfix-policyd-spf
|
||||
# http://www.openspf.org
|
||||
# version 1.06
|
||||
# $Id$
|
||||
# version 1.07
|
||||
# $Id: postfix-policyd-spf 147 2006-03-14 21:51:58Z julian $
|
||||
|
||||
use Fcntl;
|
||||
use Sys::Syslog qw(:DEFAULT setlogsock);
|
||||
|
|
@ -120,9 +120,9 @@ my $syslog_ident = "postfix/policy-spf";
|
|||
# Log an error and abort.
|
||||
#
|
||||
sub fatal_exit {
|
||||
syslog(err => "fatal_exit: @_");
|
||||
syslog(warn => "fatal_exit: @_");
|
||||
syslog(info => "fatal_exit: @_");
|
||||
syslog(err => "fatal_exit: @_");
|
||||
syslog(warning => "fatal_exit: @_");
|
||||
syslog(info => "fatal_exit: @_");
|
||||
die "fatal: @_";
|
||||
}
|
||||
|
||||
|
|
@ -149,11 +149,11 @@ my %attr;
|
|||
while (<STDIN>) {
|
||||
chomp;
|
||||
if (/=/) { my ($k, $v) = split (/=/, $_, 2); $attr{$k} = $v; next }
|
||||
elsif (length) { syslog(warn=>sprintf("warning: ignoring garbage: %.100s", $_)); next; }
|
||||
elsif (length) { syslog(warning => sprintf("warning: ignoring garbage: %.100s", $_)); next; }
|
||||
|
||||
if ($VERBOSE) {
|
||||
for (sort keys %attr) {
|
||||
syslog(debug=> "Attribute: %s=%s", $_, $attr{$_});
|
||||
syslog(debug => "Attribute: %s=%s", $_, $attr{$_});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -164,14 +164,14 @@ while (<STDIN>) {
|
|||
foreach my $handler (@HANDLERS) {
|
||||
no strict 'refs';
|
||||
my $response = $handler->(attr=>\%attr);
|
||||
syslog(debug=> "handler %s: %s", $handler, $response);
|
||||
syslog(debug => "handler %s: %s", $handler, $response);
|
||||
if ($response and $response !~ /^dunno/i) {
|
||||
syslog(info=> "handler %s: %s is decisive.", $handler, $response);
|
||||
syslog(info => "handler %s: %s is decisive.", $handler, $response);
|
||||
$action = $response; last;
|
||||
}
|
||||
}
|
||||
|
||||
syslog(info=> "decided action=%s", $action);
|
||||
syslog(info => "decided action=%s", $action);
|
||||
|
||||
print STDOUT "action=$action\n\n";
|
||||
%attr = ();
|
||||
|
|
@ -188,13 +188,13 @@ sub sender_permitted_from {
|
|||
sender=>$attr{sender},
|
||||
helo =>$attr{helo_name}) };
|
||||
if ($@) {
|
||||
syslog(info=>"%s: Mail::SPF::Query->new(%s, %s, %s) failed: %s",
|
||||
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",
|
||||
syslog(info => "%s: SPF %s: smtp_comment=%s, header_comment=%s",
|
||||
$attr{queue_id}, $result, $smtp_comment, $header_comment);
|
||||
|
||||
if ($result eq "fail") { return "REJECT $smtp_comment"; }
|
||||
|
|
@ -214,12 +214,11 @@ sub testing {
|
|||
and
|
||||
$attr{recipient} =~ /policyblock/) {
|
||||
|
||||
syslog(info=>"%s: testing: will block as requested",
|
||||
$attr{queue_id});
|
||||
syslog(info => "%s: testing: will block as requested", $attr{queue_id});
|
||||
return "REJECT smtpd-policy blocking $attr{recipient}";
|
||||
}
|
||||
else {
|
||||
syslog(info=>"%s: testing: stripped sender=%s, stripped rcpt=%s",
|
||||
syslog(info => "%s: testing: stripped sender=%s, stripped rcpt=%s",
|
||||
$attr{queue_id},
|
||||
address_stripped($attr{sender}),
|
||||
address_stripped($attr{recipient}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue