Changeset 777


Ignore:
Timestamp:
07/31/19 17:02:44 (5 years ago)
Author:
Kris Deugau
Message:

/trunk

Import or generate SOA serial numbers in tiny-import.pl. See #24.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tiny-import.pl

    r770 r777  
    569569      $loc = '' if !$loc;
    570570      $loc = '' if $loc =~ /^:+$/;
     571# Default to UNIX epoch for zones with no existing serial value
     572      $serial = scalar(time) if !$serial;
    571573
    572574      my $stampactive = 'n';
     
    588590      if ($zone =~ /\.arpa$/) {
    589591        ($code,$msg) = DNSDB::_zone2cidr($zone);
    590         $dbh->do("INSERT INTO revzones (revnet,group_id,status,default_location) VALUES (?,?,1,?)",
    591                 undef, ($msg, $importcfg{group}, $loc));
     592        $dbh->do("INSERT INTO revzones (revnet,group_id,status,default_location,zserial) VALUES (?,?,1,?,?)",
     593                undef, ($msg, $importcfg{group}, $loc, $serial));
    592594        my ($rdns) = $dbh->selectrow_array("SELECT currval('revzones_rdns_id_seq')");
    593595        my $newttl;
     
    597599                $loc, $stamp, $expires, $stampactive);
    598600      } else {
    599         $dbh->do("INSERT INTO domains (domain,group_id,status,default_location) VALUES (?,?,1,?)",
    600                 undef, ($zone, $importcfg{group}, $loc));
     601        $dbh->do("INSERT INTO domains (domain,group_id,status,default_location,zserial) VALUES (?,?,1,?,?)",
     602                undef, ($zone, $importcfg{group}, $loc, $serial));
    601603        my ($domid) = $dbh->selectrow_array("SELECT currval('domains_domain_id_seq')");
    602604        my $newttl;
Note: See TracChangeset for help on using the changeset viewer.