Changeset 3 for trunk/dnsbl/DNSBL.pm


Ignore:
Timestamp:
09/09/09 15:18:13 (15 years ago)
Author:
Kris Deugau
Message:

/trunk/dnsbl

Fix another behavioural bug in export - don't export all classful entries

in a CIDR block if that block isn't OOB or volume-listed itself

Irrelevant test-case selections added in browse.cgi and export-dnsbl
Fix export for rbldnsd by passing the mode to export() on full export
Checkpoint segment of export-dnsbl that may not be needed due to above

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dnsbl/DNSBL.pm

    r2 r3  
    297297  $level--;
    298298
     299  # need this for a bunch of things, may as well do it here
     300  my ($masklen) = ($container =~ m|/(\d+)$|);
     301
    299302# Snag all parent block "is-it-listed?" data, and stuff it into a single
    300303# variable we can use later.  Much faster than retrieving this data
    301304# individually, for each octet iteration.
    302305
     306  my $mycount = 0;
    303307  my $sql = "SELECT count(i.ip),b.block,b.level,b.listme AS oobblock,o.listme AS ooborg ".
    304308        "FROM iplist i INNER JOIN blocks b ON i.ip << b.block INNER JOIN orgs o ON b.orgid = o.orgid ".
    305309        "WHERE b.block >>= ? ".
    306310        "GROUP BY b.block,b.level,b.listme,o.listme ORDER BY b.block";
    307 
    308311  my $parsth = $dbh->prepare($sql);
    309312  $parsth->execute($container);
     
    314317    $pdata |= $bitfields{block} if $pblock;
    315318    $pdata |= $bitfields{org} if $porg;
    316   }
    317 
    318   if ($mode eq 'cidr') {
    319     $listhosts->{$container} |= $pdata if $pdata;
     319    $mycount = $pcount if $p eq $container;
     320  }
     321
     322  if ($mode eq 'cidr' || $mode eq 'rbldnsd') {
     323    $listhosts->{$container} |= $pdata if $pdata && ($ooborg || $oobblock || ($mycount >= $autolist{$masklen}));
    320324  } else {
    321 
    322325  # if $cidr->masklen is <= 24, iterate on /24 boundaries for bulk sublisting
    323326  # if $cidr->masklen is <= 16, iterate on /16 boundaries for bulk sublisting
    324327  # if $cidr->masklen is <= 8, iterate on /8 boundaries for bulk sublisting
    325328
    326     my ($masklen) = ($container =~ m|/(\d+)$|);
    327329    if ($pdata) {
    328330      my @blocksubs;
Note: See TracChangeset for help on using the changeset viewer.