Changeset 361
- Timestamp:
- 07/09/12 18:04:25 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tiny-import.pl
r360 r361 121 121 } 122 122 123 sub _rdata2string { 124 my $rdata = shift; 125 my $tmpout = ''; 126 while ($rdata) { 127 my $bytecount = 0; 128 if ($rdata =~ /^\\/) { 129 ($bytecount) = ($rdata =~ /^(\\\d{3})/); 130 $bytecount =~ s/\\/0/; 131 $bytecount = oct($bytecount); 132 $rdata =~ s/^\\\d{3}//; 133 } else { 134 ($bytecount) = ($rdata =~ /^(.)/); 135 $bytecount = ord($bytecount); 136 $rdata =~ s/^.//; 137 } 138 my @tmp = _byteparse(\$rdata, $bytecount); 139 foreach (@tmp) { $tmpout .= chr($_); } 140 ##fixme: warn or fail on long (>256? >512? >321?) strings 141 } 142 return $tmpout; 143 } 144 145 123 146 sub recslurp { 124 147 my $rec = shift; … … 451 474 } 452 475 476 } elsif ($type == 16) { 477 # TXT 478 my $txtstring = _rdata2string($rdata); 479 480 if ($fqdn =~ /\.arpa$/) { 481 ($code,$msg) = DNSDB::_zone2cidr($fqdn); 482 my ($rparent) = $dbh->selectrow_array("SELECT rdns_id FROM revzones WHERE revnet >> ?", undef, ($msg)); 483 if ($rparent) { 484 $recsth->execute(0, $rparent, $txtstring, 16, "$msg", 0, 0, 0, $ttl); 485 } else { 486 push @deferred, $rec unless $nodefer; 487 } 488 } else { 489 my $domid = DNSDB::_hostparent($dbh, $fqdn); 490 if ($domid) { 491 $recsth->execute($domid, 0, $fqdn, 16, $txtstring, 0, 0, 0, $ttl); 492 } else { 493 push @deferred, $rec unless $nodefer; 494 } 495 } 496 497 } elsif ($type == 17) { 498 # RP 499 500 } elsif ($type == 44) { 501 # SSHFP 502 453 503 } else { 454 504 # ... uhhh, dunno
Note:
See TracChangeset
for help on using the changeset viewer.