Changeset 859 for trunk/DNSDB
- Timestamp:
- 09/15/22 18:02:12 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB/ExportBIND.pm
r858 r859 65 65 eval { 66 66 67 my $arpazone = DNSDB::_ZONE($cidr, 'ZONE', 'r', '.').($cidr->{isv6} ? '.ip6.arpa' : '.in-addr.arpa'); 68 67 69 # write fresh records if: 68 70 # - we are not using the cache … … 82 84 push @loclist, $defloc unless grep /$defloc/, @loclist; 83 85 my $zonepath = $dnsdb->{bind_export_reverse_zone_path}; 84 my %zonefiles; # to be a listof file handles.86 my %zonefiles; # to be a hash of file handles. 85 87 ##fixme: need to open separate zone files for aggregated metazones eg /22 or /14 86 88 foreach my $loc (@loclist) { … … 88 90 $zfilepath =~ s/\%view/$loc/; 89 91 $zfilepath =~ s/\%zone/$revzone/; 90 my $arpazone = DNSDB::_ZONE($cidr, 'ZONE', 'r', '.').($cidr->{isv6} ? '.ip6.arpa' : '.in-addr.arpa');91 92 $zfilepath =~ s/\%arpazone/$arpazone/; 92 93 # Just In Case(TM) 93 94 $zfilepath =~ s,[^\w./-],_,g; 94 #open $zonefiles{$loc}, ">", $zfilepath; 95 open $zonefiles{$loc}, ">", $zfilepath; 96 print {$zonefiles{$loc}} "; $arpazone in view $loc\n"; 95 97 print "open zonefile for '$loc', '$zfilepath'\n"; 96 98 } … … 99 101 $soasth->execute($revid); 100 102 my (@zsoa) = $soasth->fetchrow_array(); 101 printrec_bind( $zonefilehandle, $zsoa[7], 'y', \@loclist, $revzone,103 printrec_bind(\%zonefiles, $zsoa[7], 'y', \@loclist, $revzone, 102 104 $zsoa[0],$zsoa[1],$zsoa[2],$zsoa[3],$zsoa[4],$zsoa[5],$zsoa[6],$zsoa[8],''); 103 105 … … 239 241 ##fixme?: alternate SOA serial schemes? 240 242 $serial = strftime("%Y%m%d%H", localtime()) if !$serial; 243 $primary .= "." if $primary !~ /\.$/; 244 $email .= "." if $email !~ /\.$/; 241 245 # print *{$zonefiles->{$loc}} "Z$zone:$primary:$email:$serial:$refresh:$retry:$expire:$min_ttl:$ttl:$stamp:$loc\n" 242 246 # or die $!; 243 247 print *{$zonefiles->{$loc}} "$zone $ttl IN SOA $primary $email ( $serial $refresh $retry $expire $min_ttl )\n" 244 or die $!;248 or die "couldn't write $zone SOA: $!"; 245 249 } # SOA 246 250
Note:
See TracChangeset
for help on using the changeset viewer.