Add more logging and correct test case.

This commit is contained in:
Scott Kitterman 2008-07-18 03:27:59 +00:00
commit 2fddc34a57
2 changed files with 20 additions and 4 deletions

View file

@ -2,9 +2,9 @@
# postfix-policyd-spf-perl
# http://www.openspf.org/Software
# version 2.005
# version 2.006
#
# (C) 2007 Scott Kitterman <scott@kitterman.com>
# (C) 2007-2008 Scott Kitterman <scott@kitterman.com>
# (C) 2007 Julian Mehnle <julian@mehnle.net>
# (C) 2003-2004 Meng Weng Wong <mengwong@pobox.com>
#
@ -22,7 +22,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use version; our $VERSION = qv('2.005');
use version; our $VERSION = qv('2.006');
use strict;
@ -259,12 +259,24 @@ sub sender_policy_framework {
# Reject on HELO fail. Defer on HELO temperror if message would otherwise
# be accepted. Use the HELO result and return for null sender.
if ($helo_result->is_code('fail')) {
syslog(
info => "%s: SPF %s: HELO/EHLO: %s",
$attr->{queue_id}, $helo_result, $attr->{helo_name}
);
return "550 $helo_authority_exp";
}
elsif ($helo_result->is_code('temperror')) {
syslog(
info => "%s: SPF %s: HELO/EHLO: %s",
$attr->{queue_id}, $helo_result, $attr->{helo_name}
);
return "DEFER_IF_PERMIT SPF-Result=$helo_local_exp";
}
elsif ($attr->{sender} eq '') {
syslog(
info => "%s: SPF %s: HELO/EHLO (Null Sender): %s",
$attr->{queue_id}, $helo_result, $attr->{helo_name}
);
return "PREPEND $helo_spf_header"
unless $cache->{added_spf_header}++;
}
@ -317,6 +329,10 @@ sub sender_policy_framework {
};
# Same approach as HELO....
syslog(
info => "%s: SPF %s: Envelope-from: %s",
$attr->{queue_id}, $mfrom_result, $attr->{sender}
);
if ($mfrom_result->is_code('fail')) {
return "550 $mfrom_authority_exp";
}

View file

@ -25,7 +25,7 @@ recipient=bogus@kitterman.org
queue_id=q1234
instance=3
#helo pass and mfrom fail
#helo pass and mfrom pass
request=smtpd_access_policy
client_address=72.81.252.19
helo_name=mailout00.controlledmail.com