1 |
--- plugins/dnsbl.dnsbl-checkanswer Sun Feb 26 13:22:16 2006 |
2 |
+++ plugins/dnsbl Sat Mar 18 23:15:33 2006 |
3 |
@@ -46,8 +46,10 @@ |
4 |
|
5 |
my $sel = IO::Select->new(); |
6 |
|
7 |
+ my $dom; |
8 |
for my $dnsbl (keys %dnsbl_zones) { |
9 |
# fix to find A records, if the dnsbl_zones line has a second field 20/1/04 ++msp |
10 |
+ $dom->{"$reversed_ip.$dnsbl"} = 1; |
11 |
if (defined($dnsbl_zones{$dnsbl})) { |
12 |
$self->log(LOGDEBUG, "Checking $reversed_ip.$dnsbl for A record in the background"); |
13 |
$sel->add($res->bgsend("$reversed_ip.$dnsbl")); |
14 |
@@ -58,6 +60,7 @@ |
15 |
} |
16 |
|
17 |
$self->qp->connection->notes('dnsbl_sockets', $sel); |
18 |
+ $self->qp->connection->notes('dnsbl_domains', $dom); |
19 |
|
20 |
return DECLINED; |
21 |
} |
22 |
@@ -77,6 +80,7 @@ |
23 |
$res->udp_timeout(30); |
24 |
|
25 |
my $sel = $conn->notes('dnsbl_sockets') or return ""; |
26 |
+ my $dom = $conn->notes('dnsbl_domains'); |
27 |
my $remote_ip = $self->qp->connection->remote_ip; |
28 |
|
29 |
my $result; |
30 |
@@ -99,11 +103,13 @@ |
31 |
if ($query) { |
32 |
my $a_record = 0; |
33 |
foreach my $rr ($query->answer) { |
34 |
- $a_record = 1 if $rr->type eq "A"; |
35 |
my $name = $rr->name; |
36 |
+ $self->log(LOGDEBUG, "name $name"); |
37 |
+ next unless $dom->{$name}; |
38 |
+ $self->log(LOGDEBUG, "name $name was queried"); |
39 |
+ $a_record = 1 if $rr->type eq "A"; |
40 |
($dnsbl) = ($name =~ m/(?:\d+\.){4}(.*)/) unless $dnsbl; |
41 |
$dnsbl = $name unless $dnsbl; |
42 |
- $self->log(LOGDEBUG, "name ", $rr->name); |
43 |
next unless $rr->type eq "TXT"; |
44 |
$self->log(LOGDEBUG, "got txt record"); |
45 |
$result = $rr->txtdata and last; |