Changeset 630
- Timestamp:
- 04/30/14 17:18:23 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r629 r630 1017 1017 # live record; revrec determines whether we validate the PTR or A component first. 1018 1018 1019 # Fail early on non-IP gibberish in ${$args{val}}. Arguably .arpa names might be acceptable 1020 # but that gets stupid in forward zones, since these records are shared. 1021 return ('FAIL', "$typemap{${$args{rectype}}} record must be a valid IPv4 address") 1022 if ${$args{rectype}} == 65280 && ${$args{val}} !~ /^\d+\.\d+\.\d+\.\d+$/; 1023 return ('FAIL', "$typemap{${$args{rectype}}} record must be a valid IPv6 address") 1024 if ${$args{rectype}} == 65281 && ${$args{val}} !~ /^[a-fA-F0-9:]+$/; 1025 # If things are not OK, this should prevent Stupid in the error log. 1026 $args{addr} = new NetAddr::IP ${$args{val}} 1027 or return ('FAIL', "$typemap{${$args{rectype}}} record must be a valid IPv". 1028 (${$args{rectype}} == 65280 ? '4' : '6')." address"); 1029 ${$args{val}} = $args{addr}->addr; 1030 1019 1031 if ($args{revrec} eq 'y') { 1020 1032 ($code,$msg) = $self->_validate_12(%args); … … 1078 1090 } 1079 1091 1080 # my ($ptrcount) = $dbh->selectrow_array("SELECT count(*) FROM "._rectable($args{defrec},$args{revrec}). 1081 # " WHERE val = ?", undef, ${$args{val}}); 1082 # if ($ptrcount) { 1083 # my $curid = $dbh->selectrow_array("SELECT record_id FROM "._rectable($args{defrec},$args{revrec}). 1084 # " WHERE val = ? 1085 # $msg = "PTR record for ${$args{val}} already exists; adding another will probably not do what you want"; 1086 # $code = 'WARN'; 1087 # } 1088 1092 # Add the reverse zone ID to the fieldlist 1089 1093 ${$args{fields}} .= "rdns_id,"; 1090 1094 push @{$args{vallist}}, $revid; … … 1092 1096 1093 1097 } else { # defrec eq 'y' 1098 1094 1099 if ($args{revrec} eq 'y') { 1095 1100 ($code,$msg) = $self->_validate_12(%args);
Note:
See TracChangeset
for help on using the changeset viewer.