Changeset 611 for trunk/DNSDB.pm


Ignore:
Timestamp:
04/16/14 17:45:52 (10 years ago)
Author:
Kris Deugau
Message:

/trunk

Move call to _check_hostname_form() into the individual validator subs;
it's easier to call it from those on the appropriate part(s) of the
record as needed rather than always calling it on just one part, and
then having to reproduce the per-record behaviours in _check_hostname_form().

See #53.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r610 r611  
    504504
    505505    return ('FAIL', $errstr) if !$self->_inrev($args{val}, $revzone);
     506
     507    # ${$args{val}} is either a valid IP or a string ending with the .arpa zone name;
     508    # now check if it's a well-formed FQDN
     509    return ('FAIL', $errstr) if ! _check_hostname_form($args{val}, $$rectype, $defrec, $revrec)
     510        if ${$args{val}} =~ /\.arpa$/;
    506511
    507512    # Check IP is well-formed, and that it's a v4 address
     
    38963901  return ('FAIL', "TTL must be numeric") unless $ttl =~ /^-?\d+$/;
    38973902
    3898   # Quick check on hostname parts.  There are enough variations to justify a sub now.
    3899   return ('FAIL', $errstr) if ! _check_hostname_form($$host, $$rectype, $defrec, $revrec);
    3900 
    39013903  # Collect these even if we're only doing a simple A record so we can call *any* validation sub
    39023904  my $dist = shift;
     
    40594061  # do simple validation first
    40604062  return ('FAIL', "TTL must be numeric") unless $ttl =~ /^-?\d+$/;
    4061 
    4062   # Quick check on hostname parts.  There are enough variations to justify a sub now.
    4063   return ('FAIL', $errstr) if ! _check_hostname_form($$host, $$rectype, $defrec, $revrec);
    40644063
    40654064  # only MX and SRV will use these
Note: See TracChangeset for help on using the changeset viewer.