Changeset 460
- Timestamp:
- 01/25/13 16:11:33 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns-rpc.cgi
r459 r460 450 450 if (scalar(@$reclist) == 0) { 451 451 # Aren't Magic Numbers Fun? See pseudotype list in dnsadmin. 452 my $type = ($cidr->{isv6} ? 6528 2: ($cidr->masklen == 32 ? 65280 : 65283) );452 my $type = ($cidr->{isv6} ? 65284 : ($cidr->masklen == 32 ? 65280 : 65283) ); 453 453 addRec(defrec =>'n', revrec => 'y', parent_id => $zonelist->[0]->{rdns_id}, type => $type, 454 454 address => "$cidr", %args); … … 534 534 my $reccidr = new NetAddr::IP $rec->{val}; 535 535 next unless $cidr->contains($reccidr); 536 next unless $rec->{type} == 12 || $rec->{type} == 65280 || $rec->{type} == 65281 || 537 $rec->{type} == 65282 || $rec->{type} == 65283 ||$rec->{type} == 65284; 536 538 ##fixme: multiple records, wanna wax'em all, how to report errors? 537 539 if ($args{delforward} || … … 543 545 } 544 546 } 547 if ($args{parpatt} && $zone == $cidr) { 548 # Edge case; we've just gone and axed all the records in the reverse zone. 549 # Re-add one to match the parent if we've been given a pattern to use. 550 addRec(defrec =>'n', revrec => 'y', parent_id => $zonelist->[0]->{rdns_id}, 551 type => ($zone->{isv6} ? 65284 : 65283), address => "$cidr", %args); 552 } 545 553 546 554 } else { … … 554 562 my $reccidr = new NetAddr::IP $rec->{val}; 555 563 next unless $cidr == $reccidr; 564 next unless $rec->{type} == 12 || $rec->{type} == 65280 || $rec->{type} == 65281 || 565 $rec->{type} == 65282 || $rec->{type} == 65283 ||$rec->{type} == 65284; 556 566 if ($args{delforward} || $rec->{type} == 12) { 557 567 my ($code,$msg) = DNSDB::delRec($dbh, 'n', 'y', $rec->{record_id}); … … 575 585 # that spans multiple reverse zones (eg, /23 CIDR -> 2 /24 rzones) 576 586 foreach my $zdata (@$zonelist) { 577 my $reclist = DNSDB::getDomRecs($dbh, defrec => 'n', revrec => 'y', 578 id => $zdata->{rdns_id}, filter => $zdata->{revnet}); 587 my $reclist = DNSDB::getDomRecs($dbh, defrec => 'n', revrec => 'y', id => $zdata->{rdns_id}); 579 588 if (scalar(@$reclist) == 0) { 580 my $type = ($args{cidr}->{isv6} ? 65282 : ($args{cidr}->masklen == 32 ? 65280 : 65283) ); 581 addRec(defrec =>'n', revrec => 'y', parent_id => $zdata->{rdns_id}, type => $type, 582 address => "$args{cidr}", %args); 589 # nothing to do? or do we (re)add a record based on the parent? 590 # yes, yes we do, past the close of the else 591 # my $type = ($args{cidr}->{isv6} ? 65282 : ($args{cidr}->masklen == 32 ? 65280 : 65283) ); 592 # addRec(defrec =>'n', revrec => 'y', parent_id => $zdata->{rdns_id}, type => $type, 593 # address => "$args{cidr}", %args); 583 594 } else { 584 595 foreach my $rec (@$reclist) { 585 # only the composite and/or template types; pure PTR or nontemplate composite 586 # types are nominally impossible here. 587 next unless $rec->{type} == 65282 || $rec->{type} == 65283 || $rec->{type} == 65284; 588 updateRec(defrec =>'n', revrec => 'y', id => $rec->{record_id}, 589 parent_id => $zdata->{rdns_id}, %args); 590 last; # only do one record. 596 next unless $rec->{type} == 12 || $rec->{type} == 65280 || $rec->{type} == 65281 || 597 $rec->{type} == 65282 || $rec->{type} == 65283 || $rec->{type} == 65284; 598 # Template types are only useful when attached to a reverse zone. 599 ##fixme ..... or ARE THEY? 600 if ($args{delforward} || 601 $rec->{type} == 12 || $rec->{type} == 65282 || 602 $rec->{type} == 65283 || $rec->{type} == 65284) { 603 my ($code,$msg) = DNSDB::delRec($dbh, 'n', 'y', $rec->{record_id}); 604 } else { 605 my $ret = DNSDB::downconvert($dbh, $rec->{record_id}, $DNSDB::reverse_typemap{A}); 606 } 591 607 } # foreach @$reclist 608 } # nrecs != 0 609 if ($args{parpatt}) { 610 # We've just gone and axed all the records in the reverse zone. 611 # Re-add one to match the parent if we've been given a pattern to use. 612 addRec(defrec =>'n', revrec => 'y', parent_id => $zdata->{rdns_id}, 613 type => ($cidr->{isv6} ? 65284 : 65283), 614 address => $zdata->{revnet}, name => $args{parpatt}, %args); 592 615 } 593 616 } # iterate zones within $cidr
Note:
See TracChangeset
for help on using the changeset viewer.