diff --git a/postfix-policyd-spf-perl b/postfix-policyd-spf-perl index d1a1925..229f961 100755 --- a/postfix-policyd-spf-perl +++ b/postfix-policyd-spf-perl @@ -87,10 +87,10 @@ openlog($syslog_ident, $syslog_options, $syslog_facility); # # Receive a bunch of attributes, evaluate the policy, send the result. # +my %attr; while () { chomp; - my %attr; if (/=/) { my ($key, $value) =split (/=/, $_, 2); $attr{$key} = $value; @@ -124,9 +124,10 @@ while () { } } - syslog(info => "Policy action=%s", $action); - + syslog(info => "%s: Policy action=%s", $attr{queue_id}, $action); + STDOUT->print("action=$action\n\n"); + %attr = (); } # ---------------------------------------------------------- @@ -164,11 +165,13 @@ sub sender_policy_framework { my $helo_authority_exp = $helo_result->authority_explanation if $helo_result->is_code('fail'); my $helo_spf_header = $helo_result->received_spf_header; - - syslog( - info => "%s: SPF %s: HELO/EHLO: %s, IP Address: %s, Recipient: %s", - $attr->{queue_id}, $helo_result, $attr->{helo_name}, $attr->{client_address}, $attr->{recipient} - ); + if ($VERBOSE) { + syslog( + info => "%s: SPF %s: HELO/EHLO: %s, IP Address: %s, Recipient: %s", + $attr->{queue_id}, $helo_result, $attr->{helo_name}, $attr->{client_address}, + $attr->{recipient} + ); + }; # Reject on HELO fail. Defer on HELO temperror if message would otherwise # be accepted. Use the HELO result and return for null sender. @@ -211,10 +214,13 @@ sub sender_policy_framework { if $mfrom_result->is_code('fail'); my $mfrom_spf_header = $mfrom_result->received_spf_header; - syslog( - info => "%s: SPF %s: Envelope-from: %s, IP Address: %s, Recipient: %s", - $attr->{queue_id}, $mfrom_result, $attr->{sender}, $attr->{client_address}, $attr->{recipient} - ); + if ($VERBOSE) { + syslog( + info => "%s: SPF %s: Envelope-from: %s, IP Address: %s, Recipient: %s", + $attr->{queue_id}, $mfrom_result, $attr->{sender}, $attr->{client_address}, + $attr->{recipient} + ); + }; # Same approach as HELO.... if ($mfrom_result->is_code('fail')) { diff --git a/test_cases b/test_cases index eb288bb..d0c1cf0 100644 --- a/test_cases +++ b/test_cases @@ -53,3 +53,4 @@ helo_name=mailout02.controlledmail.com sender= recipient=bogus@kitterman.org queue_id=q1234 +