- Timestamp:
- 06/29/12 17:48:31 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tiny-import.pl
r355 r356 19 19 ## 20 20 21 # WARNING: This is NOT a heavy-duty validator; it is assumed that the data 22 # being imported is more or less sane. Only minor structural validation will 23 # be done to weed out the most broken records. 24 21 25 use strict; 22 26 use warnings; … … 188 192 if ($zone =~ /\.arpa$/) { 189 193 ($code,$msg) = DNSDB::_zone2cidr($zone); 190 print "revzone $msg from $zone\n";191 194 my ($rparent) = $dbh->selectrow_array("SELECT rdns_id FROM revzones WHERE revnet >>= ?", undef, ("$msg")); 192 195 ##fixme, in concert with the CNAME check for same; automagically … … 210 213 } elsif ($rec =~ /^\^/) { 211 214 $cnt{PTR}++; 215 216 my ($rip,$host,$ttl,$stamp,$loc) = split /:/, $rec, 5; 217 $rip =~ s/^\^//; 218 $rip =~ s/\.$//; 219 $ttl = 0 if !$ttl; 220 $stamp = '' if !$stamp; 221 $loc = '' if !$loc; 222 $loc = '' if $loc =~ /^:+$/; 223 my $rparent; 224 if (my ($i, $z) = ($rip =~ /^(\d+)\.(\d+-(?:\d+\.){4}in-addr.arpa)$/) ) { 225 ($code,$msg) = DNSDB::_zone2cidr($z); 226 # Exact matches only, because we're in a sub-/24 delegation 227 ##fixme: flag the type of delegation (range, subnet-with-dash, subnet-with-slash) 228 # somewhere so we can recover it on export. probably best to do that in the revzone data. 229 ($rparent) = $dbh->selectrow_array("SELECT rdns_id FROM revzones WHERE revnet = ?", undef, ("$msg")); 230 $z =~ s/^[\d-]+//; 231 ($code,$msg) = DNSDB::_zone2cidr("$i.$z"); # Get the actual IP and normalize 232 } else { 233 ($code,$msg) = DNSDB::_zone2cidr($rip); 234 ($rparent) = $dbh->selectrow_array("SELECT rdns_id FROM revzones WHERE revnet >> ?", undef, ("$msg")); 235 } 236 if ($rparent) { 237 $recsth->execute(0, $rparent, $host, 12, $msg->addr, 0, 0, 0, $ttl); 238 } else { 239 push @deferred, $rec unless $nodefer; 240 } 212 241 213 242 } elsif ($rec =~ /^\+/) {
Note:
See TracChangeset
for help on using the changeset viewer.