Changeset 675 for trunk/cgi-bin
- Timestamp:
- 01/15/15 17:52:26 (10 years ago)
- Location:
- trunk/cgi-bin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r674 r675 32 32 &getMasterList &getTypeList &getPoolSelect &findAllocateFrom 33 33 &ipParent &subParent &blockParent &getRoutedCity 34 &allocateBlock &updateBlock &deleteBlock &getBlockData &getBlockRDNS 34 &allocateBlock &updateBlock &deleteBlock &getBlockData &getBlockRDNS &getRDNSbyIP 35 35 &getNodeList &getNodeName &getNodeInfo 36 36 &mailNotify … … 47 47 &getMasterList &getTypeList &getPoolSelect &findAllocateFrom 48 48 &ipParent &subParent &blockParent &getRoutedCity 49 &allocateBlock &updateBlock &deleteBlock &getBlockData &getBlockRDNS 49 &allocateBlock &updateBlock &deleteBlock &getBlockData &getBlockRDNS &getRDNSbyIP 50 50 &getNodeList &getNodeName &getNodeInfo 51 51 &mailNotify … … 1680 1680 1681 1681 $args{type} = 'b' if !$args{type}; 1682 my $cached = 1; 1682 1683 1683 1684 # snag entry from database … … 1721 1722 my $remote_rdns = _rpc('getRevPattern', %rpcargs); 1722 1723 $rdns = $remote_rdns if $remote_rdns; 1724 $cached = 0; 1723 1725 } 1724 1726 1725 1727 # hmm. do we care about where it actually came from? 1726 return $rdns ;1728 return $rdns, $cached; 1727 1729 } # end getBlockRDNS() 1730 1731 1732 ## IPDB::getRDNSbyIP() 1733 # Get individual reverse entries for the IP or CIDR IP range passed. Sort of looking the 1734 # opposite direction down the netblock tree compared to getBlockRDNS() above. 1735 sub getRDNSbyIP { 1736 my $dbh = shift; 1737 my %args = @_; # We want to accept a variety of call types 1738 1739 # key arguments: allocation ID, type 1740 unless ($args{id} || $args{type}) { 1741 $errstr = 'Missing allocation ID or type'; 1742 return; 1743 } 1744 1745 my @ret = (); 1746 # special case: single IP. Check if it's an allocation or in a pool, then do the RPC call for fresh data. 1747 if ($args{type} =~ /^.i$/) { 1748 my ($ip, $localrev) = $dbh->selectrow_array("SELECT ip, rdns FROM poolips WHERE id = ?", undef, ($args{id}) ); 1749 push @ret, { 'r_ip' => $ip, 'iphost' => $localrev }; 1750 } else { 1751 if ($rpc_url) { 1752 my %rpcargs = ( 1753 rpcuser => $args{user}, 1754 group => $revgroup, # not sure how this could sanely be exposed, tbh... 1755 cidr => $args{range}, 1756 ); 1757 1758 my $remote_rdns = _rpc('getRevSet', %rpcargs); 1759 return $remote_rdns; 1760 # $rdns = $remote_rdns if $remote_rdns; 1761 # $cached = 0; 1762 } 1763 } 1764 return \@ret; 1765 } # end getRDNSbyIP() 1728 1766 1729 1767 -
trunk/cgi-bin/main.cgi
r674 r675 313 313 my $block = new NetAddr::IP $webvar{block}; 314 314 315 my $rdns= getBlockRDNS($ip_dbh, id => $webvar{parent}, type => $webvar{fbtype}, user => $authuser);315 my ($rdns,$cached) = getBlockRDNS($ip_dbh, id => $webvar{parent}, type => $webvar{fbtype}, user => $authuser); 316 316 $page->param(rdns => $rdns) if $rdns; 317 317 $page->param(parent => $webvar{parent}); 318 318 $page->param(fbid => $webvar{fbid}); 319 # visual flag that we're working IPDB-local, not off more authoritative data in dnsadmin 320 $page->param(cached => $cached); 319 321 320 322 $webvar{fbtype} = '' if !$webvar{fbtype}; … … 687 689 $blockinfo->{type} =~ s/\s//; 688 690 691 my $cached; 689 692 # Get rDNS info; duplicates a bit of getBlockData but also does the RPC call if possible 690 $blockinfo->{rdns} = getBlockRDNS($ip_dbh, id => $webvar{id}, type => $blockinfo->{type}, user => $authuser); 693 ($blockinfo->{rdns},$cached) = getBlockRDNS($ip_dbh, id => $webvar{id}, type => $blockinfo->{type}, user => $authuser); 694 # visual flag that we're working IPDB-local, not off more authoritative data in dnsadmin 695 $page->param(cached => $cached); 696 697 my $cidr = new NetAddr::IP $blockinfo->{block}; 698 # Limit the per-IP rDNS list based on CIDR length; larger ones just take up too much space. 699 # Also, don't show on IP pools; the individual IPs will have a space for rDNS 700 # Don't show on single IPs; these use the "pattern" field 701 if ($IPDBacl{$authuser} =~ /c/ 702 && $cidr->masklen != $cidr->bits 703 && ($cidr->bits - $cidr->masklen) <= $IPDB::maxrevlist 704 && $webvar{alloctype} !~ /^.[dpi]/ 705 # do we want to allow v6 at all? 706 #&& ! $cidr->{isv6} 707 ) { 708 $page->param(r_iplist => getRDNSbyIP($ip_dbh, id => $webvar{id}, type => $blockinfo->{type}, 709 range => $blockinfo->{block}, user => $authuser) ); 710 } 691 711 692 712 $page->param(block => $blockinfo->{block});
Note:
See TracChangeset
for help on using the changeset viewer.