Changeset 576


Ignore:
Timestamp:
12/31/13 17:01:59 (10 years ago)
Author:
Kris Deugau
Message:

/trunk

Fix subtle bug-in-waiting where SOA records will commonly end up exported
from a forward zone last, leaving the resulting flatfile unimportable
with tiny-import.pl; do this by deliberatly exporting the SOA first, the
same as with the reverse zones.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r573 r576  
    50545054        "FROM records WHERE rdns_id=? AND type=6");
    50555055  my $recsth = $dbh->prepare("SELECT host,type,val,distance,weight,port,ttl,record_id,location,extract(epoch from stamp),expires,stampactive ".
    5056         "FROM records WHERE rdns_id=? AND not type=6 ".
     5056        "FROM records WHERE rdns_id=? AND NOT type=6 ".
    50575057        "ORDER BY masklen(CAST(val AS inet)) DESC, CAST(val AS inet)");
    50585058  my $revsth = $dbh->prepare("SELECT rdns_id,revnet,status,changed FROM revzones WHERE status=1 ".
     
    51505150  } # while ($revsth)
    51515151
     5152  $soasth = $dbh->prepare("SELECT host,type,val,distance,weight,port,ttl,record_id,location ".
     5153        "FROM records WHERE rdns_id=? AND type=6");
     5154  $recsth = $dbh->prepare("SELECT host,type,val,distance,weight,port,ttl,record_id,location,extract(epoch from stamp),expires,stampactive ".
     5155        "FROM records WHERE domain_id=? AND NOT type=6");       # Just exclude all types relating to rDNS
     5156#       "FROM records WHERE domain_id=? AND type < 65280");     # Just exclude all types relating to rDNS
    51525157  my $domsth = $dbh->prepare("SELECT domain_id,domain,status,changed FROM domains WHERE status=1 ORDER BY domain_id");
    5153   $recsth = $dbh->prepare("SELECT host,type,val,distance,weight,port,ttl,record_id,location,extract(epoch from stamp),expires,stampactive ".
    5154         "FROM records WHERE domain_id=?");      # Just exclude all types relating to rDNS
    5155 #       "FROM records WHERE domain_id=? AND type < 65280");     # Just exclude all types relating to rDNS
    51565158  $zonesth = $dbh->prepare("UPDATE domains SET changed='n' WHERE domain_id=?");
    51575159  $domsth->execute();
     
    51785180          $zonefilehandle = *ZONECACHE;
    51795181        }
     5182
     5183        # need to fetch this separately so the SOA comes first in the flatfile....
     5184        # Just In Case we need/want to reimport from the flatfile later on.
     5185        $soasth->execute($domid);
     5186        my (@zsoa) = $soasth->fetchrow_array();
     5187        _printrec_tiny($zonefilehandle, $zsoa[7], 'y',\%recflags,$dom,
     5188          $zsoa[0],$zsoa[1],$zsoa[2],$zsoa[3],$zsoa[4],$zsoa[5],$zsoa[6],$zsoa[8],'');
    51805189
    51815190        $recsth->execute($domid);
Note: See TracChangeset for help on using the changeset viewer.