Changeset 357 for trunk


Ignore:
Timestamp:
07/05/12 17:50:16 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Checkpoint: timy-import.pl

  • Fix handling of full tinydns '&' NS records; expand the hostname as per tinydns' automatic NS name, and add an A record for the NS name if an IP is present
  • Fill in '@' MX records including MX hostname expansion and A record
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tiny-import.pl

    r356 r357  
    186186      $zone =~ s/^\&//;
    187187      $zone =~ s/\.$//;
     188      $ns =~ s/\.$//;
     189      $ns = "$ns.ns.$fqdn" if $ns !~ /\./;
    188190      $ttl = 0 if !$ttl;
    189191      $stamp = '' if !$stamp;
     
    206208        if ($fparent) {
    207209          $recsth->execute($fparent, 0, $zone, 2, $ns, 0, 0, 0, $ttl);
     210          $recsth->execute($fparent, 0, $ns, 2, $ip, 0, 0, 0, $ttl) if $ip;
    208211        } else {
    209212          push @deferred, $rec unless $nodefer;
     
    268271    } elsif ($rec =~ /^\@/) {
    269272      $cnt{MX}++;
     273
     274      my ($zone,$ip,$host,$dist,$ttl,$stamp,$loc) = split /:/, $rec, 7;
     275      $zone =~ s/^\.//;
     276      $zone =~ s/\.$//;
     277      $host =~ s/\.$//;
     278      $host = "$host.mx.$zone" if $host !~ /\./;
     279      $ttl = 0 if !$ttl;
     280      $stamp = '' if !$stamp;
     281      $loc = '' if !$loc;
     282      $loc = '' if $loc =~ /^:+$/;
     283
     284# note we don't check for reverse domains here, because MX records don't make any sense in reverse zones.
     285# if this really ever becomes an issue for someone it can be expanded to handle those weirdos
     286
     287      # allow for subzone MXes, since it's perfectly legitimate to simply stuff it all in a single parent zone
     288      my $domid = DNSDB::_hostparent($dbh, $zone);
     289      if ($domid) {
     290        $recsth->execute($domid, 0, $zone, 15, $host, $dist, 0, 0, $ttl);
     291        $recsth->execute($domid, 0, $host, 1, $ip, 0, 0, 0, $ttl) if $ip;
     292      } else {
     293        push @deferred, $rec unless $nodefer;
     294      }
    270295
    271296    } elsif ($rec =~ /^'/) {
Note: See TracChangeset for help on using the changeset viewer.