Changeset 874


Ignore:
Timestamp:
10/04/22 17:08:17 (19 months ago)
Author:
Kris Deugau
Message:

/trunk

BIND export, unwinding dev saves, 26 of many many

  • Pass $cidr to publishrec_bind() for SOA records so lower layers can more easily use the CIDR
  • Add some commented pondering on %recflags around suppressing extra A records that may pop up in forward zones due to possible repeat template expansion in forward zones
  • Add a block to explicitly retrieve NS records from subdomains to ensure they get published in their parent zones when present locally
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB/ExportBIND.pm

    r873 r874  
    117117          my (@zsoa) = $soasth->fetchrow_array();
    118118##fixme: do we even need @loclist passed in?
    119           publishrec_bind(\%zonefiles, \@loclist, $zsoa[7], 'y', \%recflags, $revzone,
     119          publishrec_bind(\%zonefiles, \@loclist, $zsoa[7], 'y', \%recflags, $cidr,
    120120            $zsoa[0], $zsoa[1], $zsoa[2], $zsoa[3], $zsoa[4], $zsoa[5], $zsoa[6], $loc, '');
    121121        } # if force_refresh etc
     
    217217  $zonesth = $dnsdb->{dbh}->prepare("UPDATE domains SET changed='n' WHERE domain_id=?");
    218218  $domsth->execute();
     219
     220  # Clear %reclfags, since we explicitly want to NOT carry "I've published this
     221  # record" over from rDNS, since we have to regenerate any templates for forward
     222  # zones.  downside: small mismatches due to overridden entries.  not sure how
     223  # best to manage that.  :/
     224##fixme:  selectively delete entries to allow template_always_publish_a to flag
     225# whether extra A records get published or not.  should default to not (nb, of
     226# *course* that's the complex case) to match original tinydns template masking behaviour
     227#  %recflags = ();
    219228
    220229  while (my ($domid,$dom,$domstat,$changed) = $domsth->fetchrow_array) {
     
    318327
    319328      } # while ($recsth)
     329
     330      # retrieve NS records for subdomains.  not strictly required in current production
     331      # context but may matter sometime down the road
     332      my $subnssth = $dnsdb->{dbh}->prepare("SELECT r.host,r.val,r.ttl,r.record_id,r.loc,r.stamp,r.expires,r.stampactive ".
     333        "FROM records r ".
     334        "JOIN domains d ON r.domain_id=d.domain_id ".
     335        "WHERE r.type=2 AND d.domain LIKE ?");
     336      $subnssth->execute('%.'.$dom);
     337      while (my ($host,$val,$ttl,$recid,$loc,$stamp,$expires,$stampactive) = $subnssth->fetchrow_array) {
     338        printrec_bind(\%zonefiles, \@loclist, $recid, 'n', \%recflags, $dom,
     339          $host, 2, $val, '', '', '', $ttl, $loc, $stamp, $expires, $stampactive);
     340      } # subdomain-ns-recsth
    320341
    321342
Note: See TracChangeset for help on using the changeset viewer.