Changeset 609


Ignore:
Timestamp:
04/16/14 13:03:21 (10 years ago)
Author:
Kris Deugau
Message:

/trunk

Remove checks in addRec() and updateRec() that blocked reverse records
with a "value" that wasn't a formally correct IP address or rDNS .arpa
name for an IP.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r608 r609  
    375375  # can't do nuttin' in forward zones
    376376} # end _ipparent()
     377
     378## DNSDB::_maybeip()
     379# Wrapper for quick "does this look like an IP address?" regex, so we don't make dumb copy-paste mistakes
     380sub _maybeip {
     381  my $izzit = shift;  # reference
     382  return 1 if $$izzit =~ m,^(?:[\d\./]+|[0-9a-fA-F:/]+)$,;
     383}
    377384
    378385## DNSDB::_hostparent()
     
    38543861
    38553862  # prep for validation
    3856   # Autodetect formal .arpa names
    3857   if ($$val =~ /\.arpa\.?$/) {
    3858     my ($code,$tmpval) = _zone2cidr($$val);
    3859     return ('FAIL', $tmpval) if $code eq 'FAIL';
    3860     $$val = $tmpval;
    3861   }
    3862   my $addr = NetAddr::IP->new($$val);
     3863  my $addr = NetAddr::IP->new($$val) if _maybeip($val);
    38633864  $$host =~ s/\.+$//;   # FQDNs ending in . are an internal detail, and really shouldn't be exposed in the UI.
    38643865
     
    40244025
    40254026  # prep for validation
    4026   # Autodetect formal .arpa names
    4027   if ($$val =~ /\.arpa\.?$/) {
    4028     my ($code,$tmpval) = _zone2cidr($$val);
    4029     return ('FAIL', $tmpval) if $code eq 'FAIL';
    4030     $$val = $tmpval;
    4031   }
    4032   my $addr = NetAddr::IP->new($$val);
     4027  my $addr = NetAddr::IP->new($$val) if _maybeip($val);
    40334028  $$host =~ s/\.+$//;   # FQDNs ending in . are an internal detail, and really shouldn't be exposed in the UI.
    40344029
Note: See TracChangeset for help on using the changeset viewer.