Changeset 609
- Timestamp:
- 04/16/14 13:03:21 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r608 r609 375 375 # can't do nuttin' in forward zones 376 376 } # 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 380 sub _maybeip { 381 my $izzit = shift; # reference 382 return 1 if $$izzit =~ m,^(?:[\d\./]+|[0-9a-fA-F:/]+)$,; 383 } 377 384 378 385 ## DNSDB::_hostparent() … … 3854 3861 3855 3862 # 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); 3863 3864 $$host =~ s/\.+$//; # FQDNs ending in . are an internal detail, and really shouldn't be exposed in the UI. 3864 3865 … … 4024 4025 4025 4026 # 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); 4033 4028 $$host =~ s/\.+$//; # FQDNs ending in . are an internal detail, and really shouldn't be exposed in the UI. 4034 4029
Note:
See TracChangeset
for help on using the changeset viewer.