Changeset 623


Ignore:
Timestamp:
04/29/14 16:16:33 (11 years ago)
Author:
Kris Deugau
Message:

/trunk

Update _validate_16() (TXT) for any-record-in-any-zone. See #53.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r622 r623  
    834834  my %args = @_;
    835835
    836   if ($args{revrec} eq 'y') {
     836  if ($args{revrec} eq 'n') {
    837837    # Coerce all hostnames to end in ".DOMAIN" for group/default records,
    838838    # or the intended parent domain for live records.
    839839    my $pname = ($args{defrec} eq 'y' ? 'DOMAIN' : $self->domainName($args{id}));
    840840    ${$args{host}} =~ s/\.*$/\.$pname/ if ${$args{host}} !~ /$pname$/;
     841    return ('FAIL', $errstr) if ! _check_hostname_form(${$args{host}}, ${$args{rectype}}, $args{defrec}, $args{revrec});
     842  } else {
     843    # We don't coerce reverse "hostnames" into the zone, mainly because we store most sane
     844    # records as IP values, not .arpa names.
     845    if ($args{defrec} eq 'n') {
     846      # Get the revzone, so we can see if ${$args{val}} is in that zone
     847      my $revzone = new NetAddr::IP $self->revName($args{id}, 'y');
     848      return ('FAIL', $errstr) if !$self->_inrev($args{val}, $revzone);
     849    }
     850
     851##enhance or ##fixme
     852# convert well-formed .arpa names to IP addresses to match old "strict" validation design
     853    return ('FAIL', $errstr) if ! _check_hostname_form(${$args{val}}, ${$args{rectype}}, $args{defrec}, $args{revrec}) &&
     854      ${$args{val}} =~ /\.arpa$/;
    841855  }
    842856
     
    847861# RP record
    848862sub _validate_17 {
    849   # Probably have to validate these some day
    850   return ('OK','OK');
     863  # Probably have to validate these separately some day.  Call _validate_16() above since
     864  # they're otherwise very similar
     865  return _validate_16(@_);
    851866} # done RP record
    852867
Note: See TracChangeset for help on using the changeset viewer.