- Timestamp:
- 08/01/14 17:14:09 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r644 r653 597 597 # Forcibly append the domain name if the hostname being added does not end with the current domain name 598 598 my $pname = $self->domainName($args{id}); 599 ${$args{host}} =~ s/\.*$/\.$pname/ if ${$args{host}} !~ /$pname$/;599 ${$args{host}} =~ s/\.*$/\.$pname/ if (${$args{host}} ne '@' && ${$args{host}} !~ /$pname$/); 600 600 } 601 601 } else { … … 659 659 # CNAMEs can not be used for parent nodes; just leaf nodes with no other record types 660 660 # Enforce this for the zone name 661 return ('FAIL', "The bare zone name may not be a CNAME") if ${$args{host}} eq $pname ;661 return ('FAIL', "The bare zone name may not be a CNAME") if ${$args{host}} eq $pname || ${$args{host}} =~ /^\@/; 662 662 663 663 ##enhance: Look up the passed value to see if it exists. Ooo, fancy. … … 742 742 # Fetch the domain and append if the passed hostname isn't within it. 743 743 my $pname = ($args{defrec} eq 'y' ? 'DOMAIN' : $self->domainName($args{id})); 744 ${$args{host}} =~ s/\.*$/\.$pname/ if ${$args{host}} !~ /$pname$/;744 ${$args{host}} =~ s/\.*$/\.$pname/ if (${$args{host}} ne '@' && ${$args{host}} !~ /$pname$/); 745 745 # Validate hostname and target for form 746 746 return ('FAIL', $errstr) if ! _check_hostname_form(${$args{host}}, ${$args{rectype}}, $args{defrec}, $args{revrec}); … … 817 817 # or the intended parent domain for live records. 818 818 my $pname = ($args{defrec} eq 'y' ? 'DOMAIN' : $self->domainName($args{id})); 819 ${$args{host}} =~ s/\.*$/\.$pname/ if ${$args{host}} !~ /$pname$/; 819 ${$args{host}} =~ s/\.*$/\.$pname/ if (${$args{host}} ne '@' && ${$args{host}} !~ /$pname$/); 820 return ('FAIL', $errstr) if ! _check_hostname_form(${$args{host}}, ${$args{rectype}}, $args{defrec}, $args{revrec}); 820 821 } else { 821 822 # MX target check - IP addresses not allowed. Must be a more or less well-formed hostname. … … 855 856 # or the intended parent domain for live records. 856 857 my $pname = ($args{defrec} eq 'y' ? 'DOMAIN' : $self->domainName($args{id})); 857 ${$args{host}} =~ s/\.*$/\.$pname/ if ${$args{host}} !~ /$pname$/;858 ${$args{host}} =~ s/\.*$/\.$pname/ if (${$args{host}} ne '@' && ${$args{host}} !~ /$pname$/); 858 859 return ('FAIL', $errstr) if ! _check_hostname_form(${$args{host}}, ${$args{rectype}}, $args{defrec}, $args{revrec}); 859 860 } else { … … 1115 1116 ${$args{fields}} .= "rdns_id,"; 1116 1117 push @{$args{vallist}}, $revid; 1117 } 1118 1119 # Coerce the hostname back to the domain; this is so it displays and manipulates 1120 # sanely in the reverse zone. 1121 if (${$args{host}} eq '@') { 1122 ${$args{host}} = $self->domainName($args{id}); # errors? What errors? 1123 } 1124 } # revrec ne 'y' 1118 1125 1119 1126 } else { # defrec eq 'y' … … 1243 1250 if ($args{defrec} eq 'n') { 1244 1251 if ($args{revrec} eq 'n') { 1245 ($code,$msg) = $self->_validate_1(%args) if ${$args{rectype}} == 65280; 1246 ($code,$msg) = $self->_validate_28(%args) if ${$args{rectype}} == 65281; 1247 return ($code,$msg) if $code eq 'FAIL'; 1252 1253 # Coerce all hostnames to end in ".DOMAIN" for group/default records, 1254 # or the intended parent domain for live records. 1255 my $pname = $self->domainName($args{id}); 1256 ${$args{host}} =~ s/\.*$/\.$pname/ if ${$args{host}} !~ /$pname$/; 1257 1258 # check for form; note this checks both normal and "other" hostnames. 1259 return ('FAIL', $errstr) 1260 if !_check_hostname_form(${$args{host}}, ${$args{rectype}}, $args{defrec}, $args{revrec}); 1248 1261 1249 1262 # Check if the requested reverse zone exists - note, an IP fragment won't … … 1632 1645 # we don't actually need to test with the real IP passed; that saves a bit of fiddling. 1633 1646 _template4_expand(\$tmphost, '10.10.10.10'); 1634 if ($tmphost =~ /\%/ ) {1647 if ($tmphost =~ /\%/ || lc($tmphost) !~ /^(?:\*\.)?(?:[0-9a-z_.-]+)$/) { 1635 1648 $errstr = "Invalid template $hname"; 1636 1649 return;
Note:
See TracChangeset
for help on using the changeset viewer.