Skip to content

Add support for importing NAPTR records #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- add import CAA records into Custom zone file entries by Michal Švamberg
- fix import of multiple TXT zone records by Michal Švamberg
- add import DS records into Custom zone file entries by Michal Švamberg
- add import NAPTR records into Cusom zone file entries by Michal Švamberg

0.7.4
[project moved to sourceforge and switched to use git instead of cvs]
Expand Down
12 changes: 12 additions & 0 deletions import-zone
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ unless ($pzoneid > 0) {
$zonehash{txt}=[];
foreach $rtmp (@{$rec->{TXT}}) { push @{$zonehash{txt}}, [0,$rtmp,'']; }
foreach $rtmp (@{$rec->{CAA}}) { push @{$zonehash{zentries}}, [0,"@ IN CAA $rtmp",'']; }
foreach $rtmp (@{$rec->{NAPTR}}) { push @{$zonehash{zentries}}, [0,"@ IN NAPTR $rtmp",'']; }
$zonehash{ip}=[];
foreach $rtmp (@{$rec->{A}}) { push @{$zonehash{ip}},[0,$rtmp,'true','true']; }
foreach $rtmp (@{$rec->{AAAA}}) { push @{$zonehash{ip}},[0,$rtmp,'true','true']; }
Expand Down Expand Up @@ -200,6 +201,17 @@ foreach $host (sort keys %zonedata) {
}
next;
}
elsif (@{$rec->{NAPTR}} > 0) {
foreach $tmp (@{$rec->{NAPTR}}) {
$res = add_record("txt_entries",
{ type=>12,
ref=>$zoneid,
txt=>"$host2 $rec->{TTL} IN NAPTR \"$tmp\""
});
fatal("Failed to insert NAPTR record:\n $host2 $rec->{TTL} IN NAPTR \"$tmp\"") if ($res < 0);
}
next;
}
print STDERR "Ignoring unknown host entry: $host\n";
delete $zonedata{$host};
next;
Expand Down