Subject: | SOA gets NS and MX records belonging to A records |
Broken in 0.86 too, but unfortunately it is not in the list yet for me to choose!
If this sort of thing is encountered:
asubdomain IN A 123.45.123.45
IN NS ns0
IN NS ns1
IN MX 10 mx0
IN MX 20 mx1
the NS and MX records end up with the SOA record, and because these records have no name, they end up 'belonging' to it.
I have attached a patch (against 0.86 with patch from bug 2290) that gets around the problem by setting any empty names to the name given in the previous record, or @ if no records have appeared yet. In other words, my patch is a total hack ;)
A better solution would be to attach these NS and MX records to arrays held on the A record.
Alex
--- ZoneParse.pm.orig Wed Mar 26 10:55:20 2003
+++ ZoneParse.pm Wed Mar 26 11:01:18 2003
@@ -183,6 +183,7 @@
my $rr_types = qr/ns|a|cname/i;
my $rr_ttl = qr/(?:\d+[wdhms]?)+/i;
my $ttl_cls = qr/(?:($rr_ttl)\s+)?(?:\b($rr_class)\s+)?\s*/;
+ my $last_name = '@';
foreach (@$records) {
if (/^($valid_name)? \s* $ttl_cls ($rr_types) \s+ ($valid_name)/ix) {
@@ -192,6 +193,10 @@
$class = uc $name;
undef $name;
}
+ if (length($name) == 0) {
+ $name = $last_name;
+ }
+ $last_name = $name;
my $dns_thing = uc $type eq 'NS' ? $dns_ns{$self}
: uc $type eq 'A' ? $dns_a{$self} : $dns_cname{$self};
push @$dns_thing,
@@ -206,6 +211,10 @@
$class = uc $name;
undef $name;
}
+ if (length($name) == 0) {
+ $name = $last_name;
+ }
+ $last_name = $name;
push @{$dns_mx{$self}},
_massage({ name => $name, priority => $priority,
host => $host, ttl => $ttl, class => $class})
@@ -230,6 +239,10 @@
}
elsif (/($valid_name) \s+ $ttl_cls TXT \s+ \"([^\"]*)\"/ix)
{
+ if (length($1) == 0) {
+ $1 = $last_name;
+ }
+ $last_name = $1;
push @{$dns_txt{$self}},
_massage({ name => $1, ttl => $2, class => $3, text=> $4});
}