Changeset 105 for trunk


Ignore:
Timestamp:
07/15/11 17:45:46 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Fix AXFR import buglets on long TXT, SPF, and "other" records;

should probably push that op into a function

Allow importing PTR records; otherwise we can't import

.in-addr.arpa or .ip6.arpa reverse zones.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r104 r105  
    14031403# processing depending on the record.  le sigh.
    14041404
     1405##fixme:  what record types other than TXT can/will have >255-byte payloads?
     1406
    14051407      if ($type eq 'A') {
    14061408        push @vallist, $rr->address;
     
    14181420        $soaflag = 1;
    14191421      } elsif ($type eq 'PTR') {
     1422        push @vallist, $rr->ptrdname;
    14201423        # hmm.  PTR records should not be in forward zones.
    14211424      } elsif ($type eq 'MX') {
     
    14271430##fixme:  Net::DNS docs say this should be deprecated for rdatastr() or char_str_list(),
    14281431## but don't really seem enthusiastic about it.
    1429         push @vallist, $rr->txtdata;
     1432        my $rrdata = $rr->txtdata;
     1433        if (length($rrdata) > 100 ) {
     1434          # extralong records get an entry in a separate table.
     1435          $dbh->do("INSERT INTO longrecs (recdata) VALUES (?)", undef, ($rrdata) );
     1436          my ($longid) = $dbh->selectrow_array("SELECT longrec_id FROM longrecs WHERE recdata=?", undef, ($rrdata) );
     1437          $sql .= ",longrec_id";
     1438          $vallen .= ",?";
     1439          push @vallist, '';
     1440          push @vallist, $longid;
     1441        } else {
     1442          push @vallist, $rrdata;
     1443        }
    14301444      } elsif ($type eq 'SPF') {
    14311445##fixme: and the same caveat here, since it is apparently a clone of ::TXT
    1432         push @vallist, $rr->txtdata;
     1446        my $rrdata = $rr->txtdata;
     1447        if (length($rrdata) > 100 ) {
     1448          # extralong records get an entry in a separate table.
     1449          $dbh->do("INSERT INTO longrecs (recdata) VALUES (?)", undef, ($rrdata) );
     1450          my ($longid) = $dbh->selectrow_array("SELECT longrec_id FROM longrecs WHERE recdata=?", undef, ($rrdata) );
     1451          $sql .= ",longrec_id";
     1452          $vallen .= ",?";
     1453          push @vallist, '';
     1454          push @vallist, $longid;
     1455        } else {
     1456          push @vallist, $rrdata;
     1457        }
    14331458      } elsif ($type eq 'AAAA') {
    14341459        push @vallist, $rr->address;
     
    14441469        push @vallist, ($rr->flags.":".$rr->protocol.":".$rr->algorithm.":".$rr->key.":".$rr->keytag.":".$rr->privatekeyname);
    14451470      } else {
    1446         push @vallist, $rr->rdatastr;
     1471        my $rrdata = $rr->rdatastr;
     1472        if (length($rrdata) > 100 ) {
     1473          # extralong records get an entry in a separate table.
     1474          $dbh->do("INSERT INTO longrecs (recdata) VALUES (?)", undef, ($rrdata) );
     1475          my ($longid) = $dbh->selectrow_array("SELECT longrec_id FROM longrecs WHERE recdata=?", undef, ($rrdata) );
     1476          $sql .= ",longrec_id";
     1477          $vallen .= ",?";
     1478          push @vallist, '';
     1479          push @vallist, $longid;
     1480        } else {
     1481          push @vallist, $rrdata;
     1482        }
    14471483        # Finding a different record type is not fatal.... just problematic.
    14481484        # We may not be able to export it correctly.
Note: See TracChangeset for help on using the changeset viewer.