Changeset 708


Ignore:
Timestamp:
03/09/16 14:09:07 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

Refine TXT record export because of Stupid Clients Wot Ought Not To Be
Handling DNS. Some client libraries apparently get grumpy about TXT
records being split at 127 characters, which tinydns does automatically
on its native handling for TXT rcords. Add an option to generate
"generic" records split at 255 characters instead.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r707 r708  
    222222                template_skip_0 => 0,   # publish .0 by default
    223223                template_skip_255       => 0,   # publish .255 by default
     224                # allow TXT records to be dealt with mostly automatically by DNS server?
     225                autotxt         => 1,
    224226        );
    225227
     
    252254  # Several settings are booleans.  Handle multiple possible ways of setting them.
    253255  for my $boolopt ('log_failures', 'force_refresh', 'lowercase', 'usecache',
    254         'template_skip_0', 'template_skip_255') {
     256        'template_skip_0', 'template_skip_255', 'autotxt') {
    255257    if ($self->{$boolopt} ne '1' && $self->{$boolopt} ne '0') {
    256258      # true/false, on/off, yes/no all valid.
     
    18521854      $cfg->{template_skip_0}   = $1 if /^template_skip_0\s*=\s*([a-z01]+)/i;
    18531855      $cfg->{template_skip_255} = $1 if /^template_skip_255\s*=\s*([a-z01]+)/i;
     1856      $cfg->{autotxt}           = $1 if /^force_refresh\s*=\s*([a-z01]+)/i;
    18541857# not supported in dns.cgi yet
    18551858#      $cfg->{templatedir}      = $1 if m{^templatedir\s*=\s*([a-z0-9/_.-]+)}i;
     
    62646267# trying to interpret DNS data at all.
    62656268
    6266     print $datafile ":$host:16:";
    6267     my @txtsegs = $val =~ /.{1,255}/g;
    6268     foreach (@txtsegs) {
    6269       my $len = length($_);
    6270       s/:/\\072/g;
    6271       printf $datafile "\\%0.3o%s", $len, $_;
    6272     }
    6273     print $datafile ":$ttl:$stamp:$loc\n";
    6274 
    6275 #    $val =~ s/:/\\072/g;       # may need to replace other symbols
    6276 #make this an option?
    6277 #    print $datafile "'$host:$val:$ttl:$stamp:$loc\n" or die $!;
     6269    if ($self->{autotxt}) {
     6270      # let tinydns deal with splitting the record.  note tinydns autosplits at 127
     6271      # characters, not 255.  Because Reasons.
     6272      $val =~ s/:/\\072/g;      # may need to replace other symbols
     6273      print $datafile "'$host:$val:$ttl:$stamp:$loc\n" or die $!;
     6274    } else {
     6275      print $datafile ":$host:16:";
     6276      my @txtsegs = $val =~ /.{1,255}/g;
     6277      foreach (@txtsegs) {
     6278        my $len = length($_);
     6279        s/:/\\072/g;
     6280        printf $datafile "\\%0.3o%s", $len, $_;
     6281      }
     6282      print $datafile ":$ttl:$stamp:$loc\n";
     6283    }
    62786284
    62796285# by-hand TXT
  • trunk/dnsdb.conf

    r670 r708  
    4949#showrev_arpa = 0
    5050
     51# Let DNS server autosplit long TXT records however it pleases, or hand-generate the split points?
     52#autosplit = 1
    5153
    5254## General RPC options
Note: See TracChangeset for help on using the changeset viewer.