- Timestamp:
- 01/24/23 18:04:42 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB/ExportBIND.pm
r881 r882 111 111 "stampactive='t' AND @(extract(epoch from stamp-now())) < 600", undef, $revid))[0] ) { 112 112 $changed = 1; 113 $dnsdb->_updateserial( domain_id => $domid);113 $dnsdb->_updateserial(rdns_id => $revid); 114 114 } 115 115 # - we are not using the cache … … 324 324 $soasth->execute($domid); 325 325 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");328 326 329 327 ##fixme: do we even need @loclist passed in? … … 445 443 } 446 444 print BINDCONF "};\n\n"; 447 print "};\n\n";445 # print "};\n\n"; 448 446 } # foreach @$viewlist 449 447 rename $tmpconf, $dnsdb->{bind_zone_conf}; … … 460 458 my ($zonefiles, $loclist, $recid, $revrec, $recflags, $zone, $host, $type, $val, $distance, $weight, $port, $ttl, 461 459 $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 location464 ##fixme: maybe exclude the template types? those may be more expensive to export465 ## *ponder* may be more efficient to loop in each record print due to substitution and manipulation from stored data to formal466 ## record for .arpa zones for all records467 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 }473 460 474 461 # Just In Case something is lingering in the DB … … 502 489 503 490 # 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"; 505 492 506 493 # ... and prepend the zone name FQDN 507 494 if ($revrec eq 'y') { 508 495 my $zone2 = DNSDB::_ZONE($zone, 'ZONE', 'r', '.').($zone->{isv6} ? '.ip6.arpa' : '.in-addr.arpa'); 509 $recdata = "$zone2. 510 } else { 511 $recdata = "$zone. 496 $recdata = "$zone2. $recdata"; 497 } else { 498 $recdata = "$zone. $recdata"; 512 499 } 513 500 … … 590 577 # A and/or PTR records" irrespective of template records 591 578 $$recflags{$val} = 'ptr'; 579 return if $host eq '%blank%'; 580 592 581 if ($revrec eq 'y') { 593 582 594 583 if ($val =~ /\.arpa$/) { 595 584 # someone put in the formal .arpa name. humor them. 596 # print {$zonefiles->{$loc}} "$val $ttl IN PTR $host\n" or die $!;597 585 my $recdata = "$val. $ttl IN PTR $host.\n"; 598 586 __recprint($zonefiles, $loclist, $loc, $recdata); … … 602 590 # sub-octet v4 zone 603 591 ($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 $!;607 592 my $recdata = "$val.".DNSDB::_ZONE($zone, 'ZONE', 'r', '.').".in-addr.arpa. $ttl IN PTR $host.\n"; 608 593 __recprint($zonefiles, $loclist, $loc, $recdata); … … 610 595 # not going to care about strange results if $val is not an IP value and is resolveable in DNS 611 596 $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 $!;615 597 my $recdata = DNSDB::_ZONE($val, 'ZONE', 'r', '.').($val->{isv6} ? '.ip6.arpa' : '.in-addr.arpa'). 616 598 ". $ttl IN PTR $host.\n"; … … 636 618 if ($revrec eq 'y') { 637 619 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); 639 621 # ... but we need to tweak it for this case? so the A record gets published... 640 622 #$$recflags{$val} = 'a+ptr';
Note:
See TracChangeset
for help on using the changeset viewer.