- Timestamp:
- 01/15/15 17:52:26 (10 years ago)
- Location:
- trunk
- Files:
-
- 4 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}); -
trunk/templates/assign.tmpl
r672 r675 73 73 <tr class="<TMPL_VAR NAME=rowa>"> 74 74 <td>Reverse DNS pattern:</td> 75 <td><input type="text" name="rdns" value="<TMPL_VAR NAME=rdns>" size="40"><input type="button" value=" ? " onclick="helpRDNS()" class="regular"></td> 75 <td> 76 <input type="text" name="rdns" value="<TMPL_VAR NAME=rdns>" size="40"> 77 <input type="button" value=" ? " onclick="helpRDNS()" class="regular"> 78 <TMPL_IF cached>(cached)</TMPL_IF> 79 </td> 76 80 </tr> 77 81 -
trunk/templates/edit.tmpl
r634 r675 22 22 23 23 <tr class="row1"> 24 <td class="heading">Reverse DNS pattern:</td>25 <td class="regular"> 26 <TMPL_IF maychange>24 <td class="heading">Reverse DNS:</td> 25 <td class="regular"> 26 Pattern: <TMPL_IF maychange> 27 27 <input type="text" name="rdns" size="40" value="<TMPL_VAR NAME=rdns>"> 28 28 <TMPL_ELSE> … … 30 30 </TMPL_IF> 31 31 <input type="button" value=" ? " onclick="helpRDNS()" class="regular"> 32 <TMPL_IF cached>(cached)</TMPL_IF> 33 <TMPL_IF r_iplist> 34 <div class="rdns revdata"> 35 <ul class="collapsible notalist"> 36 <li> 37 <label for="per-iplist">Per-IP reverse entries (click to show) <img src="<TMPL_VAR NAME=webpath>/images/tree_open.png"></label> 38 <input type="checkbox" id="per-iplist" /> 39 <ul class="notalist"> 40 <li> 41 <table> 42 <TMPL_LOOP name="r_iplist"> 43 <tr> 44 <td><TMPL_VAR NAME=r_ip></td> 45 <td><input class="host" name="host_<TMPL_VAR NAME=r_ip>" value="<TMPL_VAR NAME=iphost>"></td> 46 </tr> 47 </TMPL_LOOP> 48 </table> 49 </li> 50 </ul> 51 </li> 52 </ul> 53 </div> 54 </TMPL_IF> 32 55 </td> 33 56 </tr>
Note:
See TracChangeset
for help on using the changeset viewer.