Changeset 582 for trunk/cgi-bin/main.cgi


Ignore:
Timestamp:
01/04/13 17:19:57 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Begin adding DNS integration via RPC. See #1.
IPDB.pm

  • Add a global in IPDB.pm to identify the URL for RPC DNS changes. A blank URL means this capability is disabled. (also MyIPDB.pm)
  • Accept extra parameters in addMaster() for DNS changes (default rDNS pattern, DNS location/scope/view) and while we're at it, add space to handle VRF as an informational field
  • Drop maskbits from INSERTs in addMaster()
  • Make the RPC call to add a reverse zone when adding a new master block. To assist with export caching, we split the zone into /16 or /24 chunks and add each one separately.

main.cgi

  • Retrieve DNS locations for adding a master block
  • Pass the HTTP user in to addMaster() for logging in the DNS backend

Modify templates for add master
Remove long-obsolete function in widgets.js, add function for:
Add rDNS pattern reference page

Note the RPC calls require at least dnsadmin:trunk@r447 to work properly.

File:
1 edited

Legend:

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

    r577 r582  
    1717use POSIX qw(ceil);
    1818use NetAddr::IP;
     19use Frontier::Client;
    1920
    2021use Sys::Syslog;
     
    100101    $aclerr = 'addmaster';
    101102  }
     103
     104  # Retrieve the list of DNS locations if we've got a place to grab them from
     105  if ($IPDB::rpc_url) {
     106    # Make an object to represent the XML-RPC server.
     107    my $server = Frontier::Client->new(url => $IPDB::rpc_url, debug => 0);
     108    my $result;
     109
     110    my %rpcargs = (
     111        rpcuser => $authuser,
     112        rpcsystem => 'ipdb',
     113        group => 1,     # bleh
     114        defloc => '',
     115        );
     116    $result = $server->call('dnsdb.getLocDropdown', %rpcargs);
     117    $page->param(loclist => $result);
     118  }
     119
    102120} elsif ($webvar{action} eq 'newmaster') {
    103121
     
    108126    $page->param(cidr => "$cidr");
    109127
    110     my ($code,$msg) = addMaster($ip_dbh, $webvar{cidr});
     128    my ($code,$msg) = addMaster($ip_dbh, $webvar{cidr}, (vrf => $webvar{vrf}, rdns => $webvar{rdns},
     129        rwhois => $webvar{rwhois}, defloc => $webvar{loc}, user => $authuser) );
    111130
    112131    if ($code eq 'FAIL') {
     
    114133      $page->param(err => $msg);
    115134    } else {
     135      if ($code eq 'WARN') {
     136        $msg =~ s/\n\n/<br>\n/g;
     137        $msg =~ s/:\n/:<br>\n/g;
     138        $page->param(warn => $msg);
     139      }
    116140      syslog "info", "$authuser added master block $webvar{cidr}";
    117141    }
Note: See TracChangeset for help on using the changeset viewer.