Subject: | Error deleting records from zone file |
perl -v:
This is perl, v5.6.1 built for i386-freebsd
uname -a:
FreeBSD 4.5-RELEASE
Other versions of Perl and OS are also affected
--------------------------------------------------------
Code snippet from my application:
[...]
[get values for $name and $host]
my $zonefile = DNS::ZoneParse->new("$zone_dir/$domain");
$records = $zonefile->a();
# delete the desired entry
my $counter = 0;
foreach $record (@$records) {
# match the "name" to delete
if ($record->{name} eq $name) {
# match the hostname in case a host is given (round robin support)
if (($host eq '') || ($record->{host} eq $host)) {
delete (@$records[$counter]);
}
}
$counter++;
}
Bug seen:
Sometimes there is a "IN" still standing on the deleted line.
Ex.
www IN A 10.0.0.1
after delete:
IN
This sometimes leads to corrupted zone files, since zoneparse tries
to fill up empty lines with meaningful entries...