Changeset 703 for trunk


Ignore:
Timestamp:
01/18/16 10:12:04 (8 years ago)
Author:
Kris Deugau
Message:

/trunk

Switch to hand-crafting TXT records for export, instead of using tinydns'
native handling. Some idiot DNS clients (and some... less than experienced
IT support people) don't seem to like it autosplitting TXT records at
127 characters. So we'll split them by hand at 255 characters, and pray
nobody complains.

For mid-length DKIM key records, this generally means the record won't be
split at all, and for not-completely-loony SPF records, it will be split less.

Hooray for auditing checkboxes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r701 r703  
    62406240
    62416241    ($host,$val) = __revswap($host,$val) if $revrec eq 'y';
    6242 ##fixme:  split v-e-r-y long TXT strings?  will need to do so for BIND export, at least
    6243     $val =~ s/:/\\072/g;        # may need to replace other symbols
    6244     print $datafile "'$host:$val:$ttl:$stamp:$loc\n" or die $!;
     6242# le sigh.  Some idiot DNS implementations don't seem to like tinydns autosplitting
     6243# long TXT records at 127 characters instead of 255.  Hand-crafting a record seems
     6244# to paper over the remote stupid.  We will NOT try to split on whitespace;  the
     6245# contents of a TXT record are opaque and clients who can't deal are even more broken
     6246# than the ones that don't like them split at 127 characters...  because BIND tries
     6247# to "intelligently" split TXT data, and abso-by-damn-lutely generates chunks <255
     6248# characters, and anything that can't interpret BIND's DNS responses has no business
     6249# trying to interpret DNS data at all.
     6250
     6251    print $datafile ":$host:16:";
     6252    my @txtsegs = $val =~ /.{1,255}/g;
     6253    foreach (@txtsegs) {
     6254      my $len = length($_);
     6255      s/:/\\072/g;
     6256      printf $datafile "\\%0.3o%s", $len, $_;
     6257    }
     6258    print $datafile ":$ttl:$stamp:$loc\n";
     6259
     6260#    $val =~ s/:/\\072/g;       # may need to replace other symbols
     6261#make this an option?
     6262#    print $datafile "'$host:$val:$ttl:$stamp:$loc\n" or die $!;
    62456263
    62466264# by-hand TXT
Note: See TracChangeset for help on using the changeset viewer.