From 0bd77bdc15a2ebb6511fc7d815a29c4bfc07764c Mon Sep 17 00:00:00 2001 From: Julian Mehnle <> Date: Sat, 17 Jun 2006 16:46:46 +0000 Subject: [PATCH] postfix-policyd-spf-perl/trunk/postfix-policyd-spf * Version 1.07. --- postfix-policyd-spf | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/postfix-policyd-spf b/postfix-policyd-spf index 94840d8..10842a3 100755 --- a/postfix-policyd-spf +++ b/postfix-policyd-spf @@ -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 () { 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 () { 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}),