r4567@g5: ask | 2006-03-09 04:35:43 -0800

move old branches aside


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@629 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Ask Bjørn Hansen 2006-03-09 12:37:25 +00:00
parent 3aa64debd8
commit 123346f1f5
2 changed files with 29 additions and 0 deletions

View File

@ -1,5 +1,23 @@
#!perl -w #!perl -w
=head1 NAME
spamassassin - SpamAssassin integration for qpsmtpd
=head1 DESCRIPTION
Plugin that checks if the mail is spam by using the "spamd" daemon
from the SpamAssassin package. F<http://www.spamassassin.org>
SpamAssassin 2.6 or newer is required.
=head1 CONFIG
Configured in the config/dnsbl_zones files. One line per zone name,
for example
=cut
sub register { sub register {
my ($self, $qp, $denial ) = @_; my ($self, $qp, $denial ) = @_;
if ( defined $denial and $denial =~ /^disconnect$/i ) { if ( defined $denial and $denial =~ /^disconnect$/i ) {

View File

@ -1,4 +1,5 @@
sub hook_mail { sub hook_mail {
my ($self, $transaction, $sender) = @_; my ($self, $transaction, $sender) = @_;
@ -18,8 +19,14 @@ sub hook_mail {
#push(@hosts, $helo) if $helo && $helo ne $sender->host; #push(@hosts, $helo) if $helo && $helo ne $sender->host;
for my $host (@hosts) { for my $host (@hosts) {
for my $rhsbl (keys %rhsbl_zones) { for my $rhsbl (keys %rhsbl_zones) {
# fix to find TXT records, if the rhsbl_zones line doesn't have second field
if (defined($rhsbl_zones{$rhsbl})) {
$self->log(LOGDEBUG, "Checking $host.$rhsbl for A record in the background"); $self->log(LOGDEBUG, "Checking $host.$rhsbl for A record in the background");
$sel->add($res->bgsend("$host.$rhsbl")); $sel->add($res->bgsend("$host.$rhsbl"));
} else {
$self->log(LOGDEBUG, "Checking $host.$rhsbl for TXT record in the background");
$sel->add($res->bgsend("$host.$rhsbl", "TXT"));
}
$rhsbl_zones_map{"$host.$rhsbl"} = $rhsbl_zones{$rhsbl}; $rhsbl_zones_map{"$host.$rhsbl"} = $rhsbl_zones{$rhsbl};
} }
} }
@ -80,6 +87,10 @@ sub process_sockets {
$result = $rr->name; $result = $rr->name;
$self->log(LOGDEBUG, "A record found for $result with IP " . $rr->address); $self->log(LOGDEBUG, "A record found for $result with IP " . $rr->address);
last; last;
} elsif ($rr->type eq 'TXT') {
$result = $rr->txtdata;
$self->log(LOGDEBUG, "TXT record found: " . $rr->txtdata);
last;
} }
} }
} else { } else {