Changeset 57 for trunk


Ignore:
Timestamp:
12/12/14 12:18:54 (10 years ago)
Author:
Kris Deugau
Message:

/trunk/dnsbl

Fix snafu with adding an IP that's not in a known block; the browse
"sidebar" listing was trying to browse the entire dataset instead of
properly showing nothing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dnsbl/DNSBLweb.pm

    r54 r57  
    3737    return;
    3838  }
    39   my $ret;
     39  my $ret = '';
    4040
    4141  my %args = @_;
    4242  $args{ipseen} = \%ipseen if !defined($args{ipseen});
    43   my $pblock = $args{block} || '0/0';
    4443  my $ip; 
    4544  if ($args{ip}) {
     
    4948  }
    5049  my $ipcidr = new NetAddr::IP $ip;
     50  if (!$args{block}) {
     51    # Safety net - Don't try to return the entire dataset if we were only passed an IP that
     52    # is not in a known block
     53    ($args{block}) = $dbh->selectrow_array("SELECT block FROM blocks WHERE block >> ? AND level=0", undef, $ip);
     54    return '' if !$args{block};
     55  }
     56  my $pblock = $args{block} || '0/0';
    5157
    5258  my $basesql = "SELECT b.block,o.orgname,b.listme,o.listme,b.comments,o.comments ".
Note: See TracChangeset for help on using the changeset viewer.