Changeset 495
- Timestamp:
- 05/03/13 15:36:40 (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r490 r495 49 49 &addLoc &updateLoc &delLoc &getLoc 50 50 &getLocCount &getLocList &getLocDropdown 51 &getSOA &updateSOA &getRecLine &get DomRecs&getRecCount51 &getSOA &updateSOA &getRecLine &getRecList &getRecCount 52 52 &addRec &updateRec &delRec 53 53 &getLogCount &getLogEntries … … 77 77 &addLoc &updateLoc &delLoc &getLoc 78 78 &getLocCount &getLocList &getLocDropdown 79 &getSOA &updateSOA &getRecLine &get DomRecs&getRecCount79 &getSOA &updateSOA &getRecLine &getRecList &getRecCount 80 80 &addRec &updateRec &delRec 81 81 &getLogCount &getLogEntries … … 238 238 $self->{dbh}->disconnect; 239 239 } 240 241 sub errstr { $DNSDB::errstr; } 240 242 241 243 ## … … 3465 3467 3466 3468 ##fixme: should use above (getRecLine()) to get lines for below? 3467 ## DNSDB::get DomRecs()3468 # Return records for a domain3469 # Takes a d atabase handle, default/live flag, group/domainID, start,3469 ## DNSDB::getRecList() 3470 # Return records for a group or zone 3471 # Takes a default/live flag, group or zone ID, start, 3470 3472 # number of records, sort field, and sort order 3471 3473 # Returns a reference to an array of hashes 3472 sub get DomRecs{3474 sub getRecList { 3473 3475 $errstr = ''; 3474 3476 my $self = shift; … … 3518 3520 3519 3521 my $ret = $dbh->selectall_arrayref($sql, { Slice => {} }, (@bindvars) ); 3522 $errstr = "Error retrieving records: ".$dbh->errstr if !$ret; 3520 3523 return $ret; 3521 } # end get DomRecs()3524 } # end getRecList() 3522 3525 3523 3526 -
trunk/dns-rpc.cgi
r490 r495 52 52 'dnsdb.getSOA' => \&getSOA, 53 53 'dnsdb.getRecLine' => \&getRecLine, 54 'dnsdb.get DomRecs' => \&getDomRecs,54 'dnsdb.getRecList' => \&getRecList, 55 55 'dnsdb.getRecCount' => \&getRecCount, 56 56 'dnsdb.addRec' => \&addRec, … … 341 341 } 342 342 343 sub get DomRecs{343 sub getRecList { 344 344 my %args = @_; 345 345 … … 353 353 $args{direction} = 'ASC' if !$args{direction}; 354 354 355 my $ret = $dnsdb->get DomRecs(defrec => $args{defrec}, revrec => $args{revrec}, id => $args{id},355 my $ret = $dnsdb->getRecList(defrec => $args{defrec}, revrec => $args{revrec}, id => $args{id}, 356 356 offset => $args{offset}, sortby => $args{sortby}, sortorder => $args{sortorder}, 357 357 filter => $args{filter}); … … 443 443 # We need to strip the CIDR mask on IPv4 /32 assignments, or we just add a new record all the time. 444 444 my $filt = ($cidr->{isv6} || $cidr->masklen != 32 ? "$cidr" : $cidr->addr); 445 my $reclist = $dnsdb->get DomRecs(defrec => 'n', revrec => 'y',445 my $reclist = $dnsdb->getRecList(defrec => 'n', revrec => 'y', 446 446 id => $zonelist->[0]->{rdns_id}, filter => $filt); 447 447 if (scalar(@$reclist) == 0) { … … 477 477 # that spans multiple reverse zones (eg, /23 CIDR -> 2 /24 rzones) 478 478 foreach my $zdata (@$zonelist) { 479 my $reclist = $dnsdb->get DomRecs(defrec => 'n', revrec => 'y',479 my $reclist = $dnsdb->getRecList(defrec => 'n', revrec => 'y', 480 480 id => $zdata->{rdns_id}, filter => $zdata->{revnet}); 481 481 if (scalar(@$reclist) == 0) { … … 527 527 if ($args{delsubs}) { 528 528 # Delete ALL EVARYTHING!!one11!! in $args{cidr} 529 my $reclist = $dnsdb->get DomRecs(defrec => 'n', revrec => 'y', id => $zonelist->[0]->{rdns_id});529 my $reclist = $dnsdb->getRecList(defrec => 'n', revrec => 'y', id => $zonelist->[0]->{rdns_id}); 530 530 foreach my $rec (@$reclist) { 531 531 my $reccidr = new NetAddr::IP $rec->{val}; … … 554 554 # We need to strip the CIDR mask on IPv4 /32 assignments, or we can't find single-IP records 555 555 my $filt = ($cidr->{isv6} || $cidr->masklen != 32 ? "$cidr" : $cidr->addr); 556 my $reclist = $dnsdb->get DomRecs(defrec => 'n', revrec => 'y',556 my $reclist = $dnsdb->getRecList(defrec => 'n', revrec => 'y', 557 557 id => $zonelist->[0]->{rdns_id}, filter => $filt, sortby => 'val', sortorder => 'DESC'); 558 558 foreach my $rec (@$reclist) { … … 582 582 # that spans multiple reverse zones (eg, /23 CIDR -> 2 /24 rzones) 583 583 foreach my $zdata (@$zonelist) { 584 my $reclist = $dnsdb->get DomRecs(defrec => 'n', revrec => 'y', id => $zdata->{rdns_id});584 my $reclist = $dnsdb->getRecList(defrec => 'n', revrec => 'y', id => $zdata->{rdns_id}); 585 585 if (scalar(@$reclist) == 0) { 586 586 # nothing to do? or do we (re)add a record based on the parent? -
trunk/dns.cgi
r493 r495 1961 1961 $page->param(ttl => $soa->{ttl}); 1962 1962 1963 my $foo2 = $dnsdb->get DomRecs(defrec => $def, revrec => $rev, id => $id, offset => $webvar{offset},1963 my $foo2 = $dnsdb->getRecList(defrec => $def, revrec => $rev, id => $id, offset => $webvar{offset}, 1964 1964 sortby => $sortby, sortorder => $sortorder, filter => $filter); 1965 1965 -
trunk/textrecs.cgi
r494 r495 63 63 64 64 ##fixme: do we support both HTML-plain and true plaintext? could be done, with another $webvar{} 65 # Don't die on bad parameters. Saves munging the return from get DomRecs.65 # Don't die on bad parameters. Saves munging the return from getRecList. 66 66 #my $page = HTML::Template->new(filename => "$templatedir/textrecs.tmpl", 67 67 # loop_context_vars => 1, global_vars => 1, die_on_bad_params => 0); … … 74 74 print qq(Press the "Back" button to return to the standard record list.\n\n); 75 75 76 my $reclist = $dnsdb->get DomRecs(defrec => $webvar{defrec}, revrec => $webvar{revrec}, id => $webvar{id},76 my $reclist = $dnsdb->getRecList(defrec => $webvar{defrec}, revrec => $webvar{revrec}, id => $webvar{id}, 77 77 sortby => ($webvar{revrec} eq 'n' ? 'type,host' : 'type,val'), sortorder => 'ASC'); 78 78 foreach my $rec (@$reclist) {
Note:
See TracChangeset
for help on using the changeset viewer.