spamassassin: added 'headers none' option

enables suppression of SA header insertion
This commit is contained in:
Matt Simerson 2012-11-14 15:21:44 -05:00
parent 34957d0604
commit cd4eda80e1

View File

@ -18,7 +18,7 @@ These are the common ones: score,required,autolearn,tests,version
=head1 CONFIG =head1 CONFIG
Configured in the plugins file without any parameters, the Configured in the plugins file without any parameters, the
spamassassin plugin will add relevant headers from the spamd spamassassin plugin will add relevant headers from spamd
(X-Spam-Status etc). (X-Spam-Status etc).
The format goes like The format goes like
@ -67,6 +67,11 @@ domain sockets for spamd. This is faster and more secure than using a
TCP connection, but if you run spamd on a remote machine, you need to TCP connection, but if you run spamd on a remote machine, you need to
use a TCP connection. use a TCP connection.
=item headers [none]
By default, spamassasin headers are added to messages. To suppress header
insertion, use 'headers none'.
=item leave_old_headers [drop|rename|keep] =item leave_old_headers [drop|rename|keep]
Another mail server before might have checked this mail already and may have Another mail server before might have checked this mail already and may have
@ -139,6 +144,7 @@ Make the "subject munge string" configurable
use strict; use strict;
use warnings; use warnings;
use lib 'lib';
use Qpsmtpd::Constants; use Qpsmtpd::Constants;
use Qpsmtpd::DSN; use Qpsmtpd::DSN;
@ -241,6 +247,12 @@ sub parse_spamd_response {
sub insert_spam_headers { sub insert_spam_headers {
my ( $self, $transaction, $new_headers, $username ) = @_; my ( $self, $transaction, $new_headers, $username ) = @_;
if ( $self->{_args}{headers} && $self->{_args}{headers} eq 'none' ) {
my $r = $self->parse_spam_header( $new_headers->{'X-Spam-Status'} );
$transaction->notes('spamassassin', $r);
return;
};
my $recipient_count = scalar $transaction->recipients; my $recipient_count = scalar $transaction->recipients;
$self->_cleanup_spam_header($transaction, 'X-Spam-User'); # always clean up $self->_cleanup_spam_header($transaction, 'X-Spam-User'); # always clean up
@ -410,6 +422,8 @@ sub reject {
sub munge_subject { sub munge_subject {
my ($self, $transaction) = @_; my ($self, $transaction) = @_;
return if ($self->{_args}{headers} && $self->{_args}{headers} eq 'none');
my $sa = $self->get_spam_results($transaction) or return; my $sa = $self->get_spam_results($transaction) or return;
my $qp_num = $self->{_args}{munge_subject_threshold}; my $qp_num = $self->{_args}{munge_subject_threshold};