From b0ebb75be4688b85d29d0ee2b2c448971b2036e8 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Mon, 25 Mar 2013 01:48:40 -0400 Subject: [PATCH] added karma awards for SPF pass/fail --- plugins/sender_permitted_from | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/sender_permitted_from b/plugins/sender_permitted_from index 05044d8..dcefe99 100644 --- a/plugins/sender_permitted_from +++ b/plugins/sender_permitted_from @@ -144,10 +144,16 @@ sub mail_handler { # SPF result codes: pass fail softfail neutral none error permerror temperror return $self->handle_code_none($reject, $why) if $code eq 'none'; - return $self->handle_code_fail($reject, $why) if $code eq 'fail'; - return $self->handle_code_softfail($reject, $why) if $code eq 'softfail'; - - if ( $code eq 'pass' ) { + if ( $code eq 'fail' ) { + $self->adjust_karma( -1 ); + return $self->handle_code_fail($reject, $why); + } + elsif ( $code eq 'softfail' ) { + $self->adjust_karma( -1 ); + return $self->handle_code_softfail($reject, $why); + } + elsif ( $code eq 'pass' ) { + $self->adjust_karma( 1 ); $self->log(LOGINFO, "pass, $code: $why" ); return (DECLINED); } @@ -158,12 +164,12 @@ sub mail_handler { elsif ( $code eq 'error' ) { $self->log(LOGINFO, "fail, $code, $why" ); return (DENY, "SPF - $code: $why") if $reject >= 6; - return (DENYSOFT, "SPF - $code: $why") if $reject >= 2; + return (DENYSOFT, "SPF - $code: $why") if $reject > 3; } elsif ( $code eq 'permerror' ) { $self->log(LOGINFO, "fail, $code, $why" ); return (DENY, "SPF - $code: $why") if $reject >= 6; - return (DENYSOFT, "SPF - $code: $why") if $reject >= 3; + return (DENYSOFT, "SPF - $code: $why") if $reject > 3; } elsif ( $code eq 'temperror' ) { $self->log(LOGINFO, "fail, $code, $why" );