Changeset 816


Ignore:
Timestamp:
11/25/20 15:14:46 (3 years ago)
Author:
Kris Deugau
Message:

/trunk

Ninth sampled iteration of bind-import

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bind-import

    r815 r816  
    4040
    4141##fixme:  this is wrong, BIND zone files are generally complete and we're adding.  merging records is an entire fridge full of worms.
     42##fixme:  for import, should arguably check for zone *non*existence
    4243if ($zname =~ /\.arpa\.?$/ || $zname =~ m,^[\d./]+$,) {
    4344  $rev = 'y';
     
    7475  next if /^\s*$/;
    7576  next if /^\s*;/;      # comments
    76   next if /^\s*\)/;     # SOA closing.  arguably should do some more targeted voodoo when parsing the SOA details
     77  next if /^\s*\)/;     # SOA closing (possibly other records too?)
     78                        # arguably should do some more targeted voodoo when parsing the SOA details
    7779
    7880print "($_)\n";
     
    184186my $badrec;
    185187my $curatom = 'class';
     188
    186189##fixme:  maybe wrap this in an eval() instead of the warn/badrec/last bits?
    187 for (my ($atom) = /^([\w\d]+)\s/; $nc < 3; $nc++) {
    188   if ($atom =~ /^\d+$/) {
    189     if (defined($seenatoms{ttl})) {
    190       warn "bad record ($origrec)\n";
    191       $badrec = 1;
    192       last;
    193     } else {
    194       if ($curatom ne 'class' && $curatom ne 'ttl') {
    195         warn "bad record ($origrec)\n";
    196         $badrec = 1;
    197         last;
    198       }
    199       $curatom = 'ttl';
    200       $seenatoms{ttl} = $atom;
    201     }
    202   }
    203   if ($atom =~ /^IN|CS|CH|HS$/) {
    204     if ($atom =~ /CS|CH|HS/) {
    205       warn "unsupported class $atom in record ($origrec)\n";
    206       $badrec = 1;
    207       last;
    208     }
    209     $curatom = 'class';
    210   }
    211   if ($reverse_typemap{$atom}) {
    212     print "dbg: type $atom\n";
    213   }
    214 #  my $itype = $reverse_typemap{$type};
    215 }
    216 
    217 next if $badrec;
     190eval {
     191  for (; $nc < 3; $nc++) {
     192    my ($atom) = ($rec =~ /^([\w\d.]+)\s/);
     193    if ($atom =~ /^\d+$/) {
     194      if (defined($seenatoms{ttl})) {
     195        die "bad record ($origrec)\n";
     196#        warn "bad record ($origrec)\n";
     197#        $badrec = 1;
     198#        last;
     199      } else {
     200        if ($curatom ne 'class' && $curatom ne 'ttl') {
     201          die "bad record ($origrec)\n";
     202#          warn "bad record ($origrec)\n";
     203#          $badrec = 1;
     204#          last;
     205        }
     206        $curatom = 'ttl';
     207        $seenatoms{ttl} = $atom;
     208      }
     209    }
     210    if ($atom =~ /^IN|CS|CH|HS$/) {
     211      if ($atom =~ /CS|CH|HS/) {
     212        die "unsupported class $atom in record ($origrec)\n";
     213#        warn "unsupported class $atom in record ($origrec)\n";
     214#        $badrec = 1;
     215#        last;
     216      }
     217      $curatom = 'class';
     218    }
     219    if ($reverse_typemap{$atom}) {
     220      print "dbg: type $atom\n";
     221    }
     222#    my $itype = $reverse_typemap{$type};
     223  }
     224};
     225if ($@) {
     226  warn $@;
     227  next;
     228}
     229
     230#next if $badrec;
    218231
    219232
Note: See TracChangeset for help on using the changeset viewer.