Changeset 586 for trunk/cgi-bin


Ignore:
Timestamp:
01/17/13 15:47:14 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Add rDNS to edit allocation part 1 - retrieve information for
the edit page. See #1.

Location:
trunk/cgi-bin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r585 r586  
    14621462  } elsif ($btype =~ /^.i$/) {
    14631463    my $binfo = $dbh->selectrow_hashref("SELECT ip AS block, custid, type, city, circuitid, description,".
    1464         " notes, modifystamp AS lastmod, privdata, vrf, pool, rdepth".
     1464        " notes, modifystamp AS lastmod, privdata, vrf, pool, rdepth, rdns".
    14651465        " FROM poolips WHERE ip = ?", undef, ($block) );
    14661466#       " FROM poolips WHERE ip = ? AND vrf = ?", undef, ($block, $vrf) );
     
    14681468  } else {
    14691469    my $binfo = $dbh->selectrow_hashref("SELECT cidr AS block, parent, custid, type, city, circuitid, ".
    1470         "description, notes, modifystamp AS lastmod, privdata, vrf, swip, rdepth".
     1470        "description, notes, modifystamp AS lastmod, privdata, vrf, swip, rdepth, rdns".
    14711471        " FROM allocations WHERE cidr = ? AND rdepth = ?", undef, ($block, $rdepth) );
    14721472#       " FROM allocations WHERE cidr = ? AND rdepth = ? AND vrf = ?", undef, ($block, $rdepth, $vrf) );
     
    15021502    # or sub-/19 /24 to retrieve - it's the least-wrong way to do things.
    15031503
    1504     my ($rpcblock) = $cidr->split( ($cidr->masklen <= 16 ? 16 : 24) );
     1504    my ($rpcblock) = ($cidr->masklen <= 24 ? $cidr->split( ($cidr->masklen <= 16 ? 16 : 24) ) : $cidr);
     1505
    15051506    my %rpcargs = (
    15061507        rpcuser => $args{user},
    1507         rpcsystem => 'ipdb',
    15081508        group => $revgroup,     # not sure how this could sanely be exposed, tbh...
    15091509        cidr => "$rpcblock",
    15101510        );
    15111511
    1512     eval {
    1513       $result = $server->call('dnsdb.getRevPattern', %rpcargs);
    1514     };
    1515     if ($@) {
    1516       my $msg = $@;
    1517       $msg =~ s/Fault returned from XML RPC Server, fault code 4: error executing RPC `dnsdb.addRDNS'\.\s//;
    1518     }
     1512    $rdns = _rpc('getRevPattern', %rpcargs);
    15191513  }
    15201514
  • trunk/cgi-bin/main.cgi

    r585 r586  
    654654  $blockinfo->{type} =~ s/\s//;
    655655
     656  # Get rDNS info;  duplicates a bit of getBlockData but also does the RPC call if possible
     657  $blockinfo->{rdns} = getBlockRDNS($ip_dbh, $webvar{block}, $webvar{rdepth}, user => $authuser);
     658
    656659  $page->param(block => $webvar{block});
     660  $page->param(rdns     => $blockinfo->{rdns});
    657661  $page->param(rdepth   => $blockinfo->{rdepth});
    658662
Note: See TracChangeset for help on using the changeset viewer.