Changeset 882


Ignore:
Timestamp:
01/24/23 18:04:42 (15 months ago)
Author:
Kris Deugau
Message:

/trunk

BIND export, unwinding dev saves, 30 of ~35?

  • File off another dangling copy-paste-didn't-update-variable-names oops
  • Remove some stray leftover from a dead-end new change
  • Comment a stray debugging output, pending removal Soonish(TM)
  • Drop looping over the location at the top of printrec_bind(), since that's been pushed down to final leaf recprint() mainly for proper template cascading
  • Fix some record output whitespace improperly converted from tab to space
  • Properly skip record output on %blank% PTR
  • Remove some old reference comments
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB/ExportBIND.pm

    r881 r882  
    111111                "stampactive='t' AND @(extract(epoch from stamp-now())) < 600", undef, $revid))[0] ) {
    112112          $changed = 1;
    113           $dnsdb->_updateserial(domain_id => $domid);
     113          $dnsdb->_updateserial(rdns_id => $revid);
    114114        }
    115115#  - we are not using the cache
     
    324324          $soasth->execute($domid);
    325325          my ($soa_host, $soa_val, $soa_ttl, $soa_id, $soa_loc) = $soasth->fetchrow_array;
    326 $dnsdb->{dbh}->selectrow_array(
    327             "SELECT host,val,ttl,record_id,location FROM records WHERE domain_id=? AND type=6");
    328326
    329327##fixme: do we even need @loclist passed in?
     
    445443      }
    446444      print BINDCONF "};\n\n";
    447       print "};\n\n";
     445#      print "};\n\n";
    448446    } # foreach @$viewlist
    449447    rename $tmpconf, $dnsdb->{bind_zone_conf};
     
    460458  my ($zonefiles, $loclist, $recid, $revrec, $recflags, $zone, $host, $type, $val, $distance, $weight, $port, $ttl,
    461459        $loc, $stamp, $expires, $stampactive) = @_;
    462 
    463 # make sure "global" records get into all the right per-view zone files, without having to do this loop in each record-print location
    464 ##fixme:  maybe exclude the template types?  those may be more expensive to export
    465 ## *ponder*  may be more efficient to loop in each record print due to substitution and manipulation from stored data to formal
    466 ## record for .arpa zones for all records
    467   if ($loc eq '') {
    468     foreach my $subloc (@{$loclist}) {
    469       printrec_bind($dnsdb, $zonefiles, $loclist, $recid, $revrec, $recflags, $zone, $host, $type, $val,
    470         $distance, $weight, $port, $ttl, $subloc, $stamp, $expires, $stampactive);
    471     }
    472   }
    473460
    474461  # Just In Case something is lingering in the DB
     
    502489
    503490    # Prepare the body of the record
    504     my $recdata = "$ttl        IN      SOA     $primary        $email  ( $serial $refresh $retry $expire $min_ttl )\n";
     491    my $recdata = "$ttl IN      SOA     $primary        $email  ( $serial $refresh $retry $expire $min_ttl )\n";
    505492
    506493    # ... and prepend the zone name FQDN
    507494    if ($revrec eq 'y') {
    508495      my $zone2 = DNSDB::_ZONE($zone, 'ZONE', 'r', '.').($zone->{isv6} ? '.ip6.arpa' : '.in-addr.arpa');
    509       $recdata = "$zone2.      $recdata";
    510     } else {
    511       $recdata = "$zone.       $recdata";
     496      $recdata = "$zone2.       $recdata";
     497    } else {
     498      $recdata = "$zone.        $recdata";
    512499    }
    513500
     
    590577       # A and/or PTR records" irrespective of template records
    591578    $$recflags{$val} = 'ptr';
     579    return if $host eq '%blank%';
     580
    592581    if ($revrec eq 'y') {
    593582
    594583      if ($val =~ /\.arpa$/) {
    595584        # someone put in the formal .arpa name.  humor them.
    596 #        print {$zonefiles->{$loc}} "$val       $ttl    IN      PTR     $host\n" or die $!;
    597585        my $recdata = "$val.    $ttl    IN      PTR     $host.\n";
    598586        __recprint($zonefiles, $loclist, $loc, $recdata);
     
    602590          # sub-octet v4 zone
    603591          ($val) = ($val =~ /\.(\d+)$/);
    604 #          print {$zonefiles->{$loc}} "$val.".DNSDB::_ZONE($zone, 'ZONE', 'r', '.').'.in-addr.arpa'.
    605 #               "       $ttl    IN      PTR     $host\n"
    606 #            or die $!;
    607592          my $recdata = "$val.".DNSDB::_ZONE($zone, 'ZONE', 'r', '.').".in-addr.arpa.   $ttl    IN      PTR     $host.\n";
    608593          __recprint($zonefiles, $loclist, $loc, $recdata);
     
    610595          # not going to care about strange results if $val is not an IP value and is resolveable in DNS
    611596          $val = NetAddr::IP->new($val);
    612 #          print {$zonefiles->{$loc}} DNSDB::_ZONE($val, 'ZONE', 'r', '.').($val->{isv6} ? '.ip6.arpa' : '.in-addr.arpa').
    613 #               "       $ttl    IN      PTR     $host\n"
    614 #            or die $!;
    615597          my $recdata = DNSDB::_ZONE($val, 'ZONE', 'r', '.').($val->{isv6} ? '.ip6.arpa' : '.in-addr.arpa').
    616598                ".      $ttl    IN      PTR     $host.\n";
     
    636618    if ($revrec eq 'y') {
    637619      printrec_bind($dnsdb, $zonefiles, $loclist, $recid, $revrec, $recflags, $zone, $host, 12, $val,
    638        $distance, $weight, $port, $ttl, $loc, $stamp, $expires, $stampactive);
     620        $distance, $weight, $port, $ttl, $loc, $stamp, $expires, $stampactive);
    639621# ... but we need to tweak it for this case?  so the A record gets published...
    640622#$$recflags{$val} = 'a+ptr';
Note: See TracChangeset for help on using the changeset viewer.