Fix for ignoring multiple dns returns

git-svn-id: https://svn.perl.org/qpsmtpd/trunk@562 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Matt Sergeant 2005-11-11 14:29:45 +00:00
parent a405e64e1c
commit 2af297f49c

View File

@ -34,7 +34,6 @@ sub connect_handler {
my $reversed_ip = join(".", reverse(split(/\./, $remote_ip))); my $reversed_ip = join(".", reverse(split(/\./, $remote_ip)));
$self->transaction->notes('pending_dns_queries', scalar(keys(%dnsbl_zones)));
my $qp = $self->qp; my $qp = $self->qp;
for my $dnsbl (keys %dnsbl_zones) { for my $dnsbl (keys %dnsbl_zones) {
# fix to find A records, if the dnsbl_zones line has a second field 20/1/04 ++msp # fix to find A records, if the dnsbl_zones line has a second field 20/1/04 ++msp
@ -63,13 +62,10 @@ sub connect_handler {
sub process_a_result { sub process_a_result {
my ($qp, $template, $result, $query) = @_; my ($qp, $template, $result, $query) = @_;
my $pending = $qp->transaction->notes('pending_dns_queries');
$qp->transaction->notes('pending_dns_queries', --$pending);
warn("Result for A $query: $result\n"); warn("Result for A $query: $result\n");
if ($result !~ /^\d+\.\d+\.\d+\.\d+$/) { if ($result !~ /^\d+\.\d+\.\d+\.\d+$/) {
# NXDOMAIN or ERROR possibly... # NXDOMAIN or ERROR possibly...
$qp->finish_continuation unless $pending; $qp->finish_continuation if $qp->input_sock->readable;
return; return;
} }
@ -77,29 +73,26 @@ sub process_a_result {
my $ip = $conn->remote_ip; my $ip = $conn->remote_ip;
$template =~ s/%IP%/$ip/g; $template =~ s/%IP%/$ip/g;
$conn->notes('dnsbl', $template) unless $conn->notes('dnsbl'); $conn->notes('dnsbl', $template) unless $conn->notes('dnsbl');
$qp->finish_continuation unless $pending; $qp->finish_continuation if $qp->input_sock->readable;
} }
sub process_txt_result { sub process_txt_result {
my ($qp, $result, $query) = @_; my ($qp, $result, $query) = @_;
my $pending = $qp->transaction->notes('pending_dns_queries');
$qp->transaction->notes('pending_dns_queries', --$pending);
warn("Result for TXT $query: $result\n"); warn("Result for TXT $query: $result\n");
if ($result !~ /[a-z]/) { if ($result !~ /[a-z]/) {
# NXDOMAIN or ERROR probably... # NXDOMAIN or ERROR probably...
$qp->finish_continuation unless $pending; $qp->finish_continuation if $qp->input_sock->readable;
return; return;
} }
my $conn = $qp->connection; my $conn = $qp->connection;
$conn->notes('dnsbl', $result) unless $conn->notes('dnsbl'); $conn->notes('dnsbl', $result) unless $conn->notes('dnsbl');
$qp->finish_continuation unless $pending; $qp->finish_continuation if $qp->input_sock->readable;
} }
sub pickup_handler { sub pickup_handler {
my ($self, $transaction, $rcpt) = @_; my ($self, $transaction) = @_;
# RBLSMTPD being non-empty means it contains the failure message to return # RBLSMTPD being non-empty means it contains the failure message to return
if (defined ($ENV{'RBLSMTPD'}) && $ENV{'RBLSMTPD'} ne '') { if (defined ($ENV{'RBLSMTPD'}) && $ENV{'RBLSMTPD'} ne '') {