Changeset 809


Ignore:
Timestamp:
11/24/20 17:11:26 (4 years ago)
Author:
Kris Deugau
Message:

/trunk

Second sampled historic iteration of bind-import

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bind-import

    r808 r809  
    3333my $zid;
    3434
    35 if ($zname =~ /\.arpa$/ || $zname =~ m,^[\d./]+$,) {
     35if ($zname =~ /\.arpa\.?$/ || $zname =~ m,^[\d./]+$,) {
    3636  $rev = 'y';
    37   $zname = _zone2cidr($zname) if $zname =~ /\.arpa$/;
     37  $zname = _zone2cidr($zname) if $zname =~ /\.arpa\.?$/;
    3838  $zid = $dnsdb->revID($zname,':ANY:');
     39  if ($zid) {
     40    $zname = new NetAddr::IP $zname;
     41    $zname = DNSDB::_ZONE($zname, 'ZONE', 'r', '.').($zname->{isv6} ? '.ip6.arpa' : '.in-addr.arpa');
     42  }
    3943} else {
    4044  $zid = $dnsdb->domainID($zname,':ANY:');
     
    5054  next if /^\s*;/;
    5155  my ($name) = /([\w_.-]+)\s/;
     56  # append zone name to record name if missing AND not dot-terminated;
     57  # this happens automagically for forward zones, but not reverse because Reasons.  (fixme?)
     58  # suck up and deal with the error if the dot-termiated name is out of zone;  should be
     59  # impossible with valid BIND zone file but...
     60  $name .= ".$zname" if $name !~ /$zname$/ && $zname !~ /\.$/;
    5261  s/([\w_.-]+)\s+//;
    5362  my ($class) = /(IN|CS|CH|HS)\s/;
     
    9099#;imap   IN      900     CNAME   deepnet.cx.
    91100##fixme:  not sure how to handle the case where someone leaves off the class.
    92   my ($code,$msg) = $dnsdb->addRec('n', $rev, $zid, \$name, \$itype, \$rdata, $ttl);
     101  my ($code, $msg);
     102  if ($rev eq 'n') {
     103    ($code,$msg) = $dnsdb->addRec('n', $rev, $zid, \$name, \$itype, \$rdata, $ttl);
     104  } else {
     105    ($code,$msg) = $dnsdb->addRec('n', $rev, $zid, \$rdata, \$itype, \$name, $ttl);
     106  }
    93107  print "$code: $msg\n";
    94108}
Note: See TracChangeset for help on using the changeset viewer.