Changeset 350


Ignore:
Timestamp:
06/26/12 13:48:00 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Tweak addRec() and updateRec() to allow "bad" hostnames so TXT records
can be used in reverse zones
Expand export of TXT records to properly export them in reverse zones

Thanks to Steve Atkins for pointing this out on the pgsql-general mailing list.

See #26.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r349 r350  
    31413141  # of types.  Other things may also be added to validate default records of several flavours.
    31423142  return ('FAIL', "Hostnames may not contain anything other than (0-9 a-z . _)")
    3143         if $defrec eq 'n' && $$host !~ /^[0-9a-z_%.-]+$/i;
     3143        if $defrec eq 'n' && ($revrec eq 'y' ? $$rectype != $reverse_typemap{TXT} : 1) &&
     3144                $$host !~ /^[0-9a-z_%.-]+$/i;
    31443145
    31453146  # Collect these even if we're only doing a simple A record so we can call *any* validation sub
     
    32563257  # of types.  Other things may also be added to validate default records of several flavours.
    32573258  return ('FAIL', "Hostnames may not contain anything other than (0-9 a-z - . _)")
    3258         if $defrec eq 'n' && $$host !~ /^[0-9a-z_%.-]+$/i;
     3259        if $defrec eq 'n' && ($revrec eq 'y' ? $$rectype != $reverse_typemap{TXT} : 1) &&
     3260                $$host !~ /^[0-9a-z_%.-]+$/i;
    32593261
    32603262  # only MX and SRV will use these
     
    44084410
    44094411##fixme:  split v-e-r-y long TXT strings?  will need to do so for BIND export, at least
    4410         $val =~ s/:/\\072/g;    # may need to replace other symbols
    4411         print $datafile "'$host:$val:$ttl:$stamp:$loc\n";
     4412        if ($revrec eq 'n') {
     4413          $val =~ s/:/\\072/g;  # may need to replace other symbols
     4414          print $datafile "'$host:$val:$ttl:$stamp:$loc\n";
     4415        } else {
     4416          $host =~ s/:/\\072/g; # may need to replace other symbols
     4417          my $val2 = NetAddr::IP->new($val);
     4418          print $datafile "'"._ZONE($val2, 'ZONE', 'r', '.').($val2->{isv6} ? '.ip6.arpa' : '.in-addr.arpa').
     4419                ":$host:$ttl:$stamp:$loc\n";
     4420        }
    44124421
    44134422# by-hand TXT
Note: See TracChangeset for help on using the changeset viewer.