From 123346f1f53748cd6fd5e8be35e8e087cb0ef5b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ask=20Bj=C3=B8rn=20Hansen?= Date: Thu, 9 Mar 2006 12:37:25 +0000 Subject: [PATCH] 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 --- plugins/dnsbl | 18 ++++++++++++++++++ plugins/rhsbl | 11 +++++++++++ 2 files changed, 29 insertions(+) diff --git a/plugins/dnsbl b/plugins/dnsbl index 7bed581..7b82221 100644 --- a/plugins/dnsbl +++ b/plugins/dnsbl @@ -1,5 +1,23 @@ #!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 + +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 { my ($self, $qp, $denial ) = @_; if ( defined $denial and $denial =~ /^disconnect$/i ) { diff --git a/plugins/rhsbl b/plugins/rhsbl index 4003630..7c7dd79 100644 --- a/plugins/rhsbl +++ b/plugins/rhsbl @@ -1,4 +1,5 @@ + sub hook_mail { my ($self, $transaction, $sender) = @_; @@ -18,8 +19,14 @@ sub hook_mail { #push(@hosts, $helo) if $helo && $helo ne $sender->host; for my $host (@hosts) { 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"); $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}; } } @@ -80,6 +87,10 @@ sub process_sockets { $result = $rr->name; $self->log(LOGDEBUG, "A record found for $result with IP " . $rr->address); last; + } elsif ($rr->type eq 'TXT') { + $result = $rr->txtdata; + $self->log(LOGDEBUG, "TXT record found: " . $rr->txtdata); + last; } } } else {