Changeset 750 for trunk/cgi-bin


Ignore:
Timestamp:
06/17/15 18:12:54 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

Update "edit block" page to use per-block rDNS-is-available flag to
decide whether to show rDNS segment or not. See #1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/main.cgi

    r735 r750  
    873873  # snag block info from db
    874874  my $blockinfo = getBlockData($ip_dbh, $webvar{id}, $webvar{basetype});
     875  my $cidr = new NetAddr::IP $blockinfo->{block};
    875876  $page->param(id       => $webvar{id});
    876877  $page->param(basetype => $webvar{basetype});
     
    887888  $blockinfo->{type} =~ s/\s//;
    888889
    889   my $cached;
    890   # Get rDNS info;  duplicates a bit of getBlockData but also does the RPC call if possible
    891   ($blockinfo->{rdns},$cached) = getBlockRDNS($ip_dbh, id => $webvar{id}, type => $blockinfo->{type}, user => $authuser);
    892   # visual flag that we're working IPDB-local, not off more authoritative data in dnsadmin
    893   $page->param(cached   => $cached);
    894 
    895   my $cidr = new NetAddr::IP $blockinfo->{block};
    896   # Limit the per-IP rDNS list based on CIDR length;  larger ones just take up too much space.
    897   # Also, don't show on IP pools;  the individual IPs will have a space for rDNS
    898   # Don't show on single IPs;  these use the "pattern" field
    899   if ($IPDBacl{$authuser} =~ /c/
    900       && $cidr->masklen != $cidr->bits
    901       && ($cidr->bits - $cidr->masklen) <= $IPDB::maxrevlist
    902       && $blockinfo->{type} !~ /^.[dpi]/
    903       # do we want to allow v6 at all?
    904       #&& ! $cidr->{isv6}
    905       ) {
    906     $page->param(r_iplist => getRDNSbyIP($ip_dbh, id => $webvar{id}, type => $blockinfo->{type},
    907         range => $blockinfo->{block}, user => $authuser) );
    908   }
     890  if ($blockinfo->{revzone}) {
     891    $page->param(revzone => $blockinfo->{revzone});
     892    my $cached;
     893    # Get rDNS info;  duplicates a bit of getBlockData but also does the RPC call if possible
     894    ($blockinfo->{rdns},$cached) = getBlockRDNS($ip_dbh, id => $webvar{id}, type => $blockinfo->{type}, user => $authuser);
     895    # visual flag that we're working IPDB-local, not off more authoritative data in dnsadmin
     896    $page->param(cached   => $cached);
     897
     898    # Limit the per-IP rDNS list based on CIDR length;  larger ones just take up too much space.
     899    # Also, don't show on IP pools;  the individual IPs will have a space for rDNS
     900    # Don't show on single IPs;  these use the "pattern" field
     901    if ($IPDBacl{$authuser} =~ /c/
     902        && $cidr->masklen != $cidr->bits
     903        && ($cidr->bits - $cidr->masklen) <= $IPDB::maxrevlist
     904        && $blockinfo->{type} !~ /^.[dpi]/
     905        # do we want to allow v6 at all?
     906        #&& ! $cidr->{isv6}
     907        ) {
     908      $page->param(r_iplist => getRDNSbyIP($ip_dbh, id => $webvar{id}, type => $blockinfo->{type},
     909          range => $blockinfo->{block}, user => $authuser) );
     910    }
     911  } # rDNS availability check
    909912
    910913  # consider extending this to show time as well as date
Note: See TracChangeset for help on using the changeset viewer.