Changeset 249
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r248 r249 346 346 ${$args{val}} = $args{addr}->addr; 347 347 } else { 348 ${$args{val}} =~ s/^\.*/ZONE./ ;348 ${$args{val}} =~ s/^\.*/ZONE./ unless ${$args{val}} =~ /^ZONE/; 349 349 } 350 350 } elsif (${$args{val}} =~ /[a-f:]/) { … … 363 363 ${$args{val}} = "ZONE,${$args{val}}"; 364 364 } 365 ${$args{host}} =~ s/\.*$/\.$config{domain}/ if ${$args{host}} !~ / $config{domain}$/;365 ${$args{host}} =~ s/\.*$/\.$config{domain}/ if ${$args{host}} !~ /(?:$config{domain}|ADMINDOMAIN)$/; 366 366 } 367 367 … … 369 369 # and tend to fail in the most awkward way possible. Check and warn. 370 370 # We use $val instead of $addr->addr since we may be in a defrec, and may have eg "ZONE::42" or "ZONE.12" 371 my ($ptrcount) = $dbh->selectrow_array("SELECT count(*) FROM "._rectable($args{defrec},$args{revrec}). 372 " WHERE val = ?", undef, ${$args{val}}); 373 return ('WARN', "PTR record for ${$args{val}} already exists; adding another will probably not do what you want") 371 372 my @checkvals = (${$args{val}}); 373 if (${$args{val}} =~ /,/) { 374 # push . and :: variants into checkvals if val has , 375 my $tmp; 376 ($tmp = ${$args{val}}) =~ s/,/./; 377 push @checkvals, $tmp; 378 ($tmp = ${$args{val}}) =~ s/,/::/; 379 push @checkvals, $tmp; 380 } 381 my $pcsth = $dbh->prepare("SELECT count(*) FROM "._rectable($args{defrec},$args{revrec})." WHERE val = ?"); 382 foreach my $checkme (@checkvals) { 383 my $ptrcount; 384 ($ptrcount) = $dbh->selectrow_array("SELECT count(*) FROM "._rectable($args{defrec},$args{revrec}). 385 " WHERE val = ?", undef, ($checkme)); 386 return ('WARN', "PTR record for $checkme already exists; adding another will probably not do what you want") 374 387 if $ptrcount; 388 } 375 389 } else { 376 390 # Not absolutely true but only useful if you hack things up for sub-/24 v4 reverse delegations … … 2010 2024 # Call the validation sub for the type requested. 2011 2025 ($retcode,$retmsg) = $validators{$$rectype}($dbh, (defrec => $defrec, revrec => $revrec, id => $id, 2012 host => \$host, rectype => $rectype, val => \$val, addr => $addr,2026 host => $host, rectype => $rectype, val => $val, addr => $addr, 2013 2027 dist => \$dist, port => \$port, weight => \$weight, 2014 2028 fields => \$fields, vallist => \@vallist) ); … … 2018 2032 # Set up database fields and bind parameters 2019 2033 $fields .= "host,type,val,ttl,"._recparent($defrec,$revrec); 2020 push @vallist, ($ host,$$rectype,$val,$ttl,$id);2034 push @vallist, ($$host,$$rectype,$$val,$ttl,$id); 2021 2035 my $vallen = '?'.(',?'x$#vallist); 2022 2036 -
trunk/dns.cgi
r248 r249 560 560 561 561 my @recargs = ($dbh,$webvar{defrec},$webvar{revrec},$webvar{parentid}, 562 $webvar{name},\$webvar{type},$webvar{address},$webvar{ttl});562 \$webvar{name},\$webvar{type},\$webvar{address},$webvar{ttl}); 563 563 if ($webvar{type} == $reverse_typemap{MX} or $webvar{type} == $reverse_typemap{SRV}) { 564 564 push @recargs, $webvar{distance}; -
trunk/dns.sql
r224 r249 51 51 ); 52 52 53 COPY default_rev_records (record_id, group_id, host, "type", ip, ttl, description) FROM stdin;53 COPY default_rev_records (record_id, group_id, host, "type", val, ttl, description) FROM stdin; 54 54 1 1 hostmaster.ADMINDOMAIN:ns1.ADMINDOMAIN 6 3600:900:1048576:2560 3600 55 55 2 1 unused-%r.ADMINDOMAIN 65283 ZONE 3600
Note:
See TracChangeset
for help on using the changeset viewer.