Another DNS fix. dnsbl did insufficient sanity checking on the response
it got. 

        hp

-- 
   _  | Peter J. Holzer    | Schlagfertigkeit ist das, was einem
|_|_) | Sysadmin WSR       | auf dem Nachhauseweg einfällt.
| |   | [EMAIL PROTECTED]         |    -- Lars 'Cebewee' Noschinski in dasr.
__/   | http://www.hjp.at/ |
--- plugins/dnsbl.dnsbl-checkanswer     Sun Feb 26 13:22:16 2006
+++ plugins/dnsbl       Sat Mar 18 23:15:33 2006
@@ -46,8 +46,10 @@
 
   my $sel = IO::Select->new();
 
+  my $dom;
   for my $dnsbl (keys %dnsbl_zones) {
     # fix to find A records, if the dnsbl_zones line has a second field 
20/1/04 ++msp
+    $dom->{"$reversed_ip.$dnsbl"} = 1;
     if (defined($dnsbl_zones{$dnsbl})) {
       $self->log(LOGDEBUG, "Checking $reversed_ip.$dnsbl for A record in the 
background");
       $sel->add($res->bgsend("$reversed_ip.$dnsbl"));
@@ -58,6 +60,7 @@
   }
 
   $self->qp->connection->notes('dnsbl_sockets', $sel);
+  $self->qp->connection->notes('dnsbl_domains', $dom);
 
   return DECLINED;
 }
@@ -77,6 +80,7 @@
   $res->udp_timeout(30);
 
   my $sel = $conn->notes('dnsbl_sockets') or return "";
+  my $dom = $conn->notes('dnsbl_domains');
   my $remote_ip = $self->qp->connection->remote_ip;
 
   my $result; 
@@ -99,11 +103,13 @@
     if ($query) {
       my $a_record = 0;
       foreach my $rr ($query->answer) {
-       $a_record = 1 if $rr->type eq "A";
        my $name = $rr->name;
+       $self->log(LOGDEBUG, "name $name");
+       next unless $dom->{$name};
+       $self->log(LOGDEBUG, "name $name was queried");
+       $a_record = 1 if $rr->type eq "A";
        ($dnsbl) = ($name =~ m/(?:\d+\.){4}(.*)/) unless $dnsbl;
        $dnsbl = $name unless $dnsbl;
-       $self->log(LOGDEBUG, "name ", $rr->name);
        next unless $rr->type eq "TXT";
        $self->log(LOGDEBUG, "got txt record");
        $result = $rr->txtdata and last;

Attachment: signature.asc
Description: Digital signature

Reply via email to