Subject: | [PATCH] NAPTR with trailing whitespace/comments is not parsed correctly |
Date: | Mon, 6 May 2013 22:08:06 +0200 |
To: | bug-Net-DNS-ZoneFile-Fast [...] rt.cpan.org |
From: | Anton Berezin <tobez [...] tobez.org> |
Additionally, the replacement field is nor normalized.
The following patch fixes both problems:
diff -u --show-c-function -ruN Net-DNS-ZoneFile-Fast-1.20/Fast.pm Net-DNS-ZoneFile-Fast/Fast.pm
--- Net-DNS-ZoneFile-Fast-1.20/Fast.pm 2013-04-18 21:22:08.000000000 +0200
+++ Net-DNS-ZoneFile-Fast/Fast.pm 2013-05-06 21:59:03.000000000 +0200
@@ -1090,7 +1090,7 @@ sub parse_line
};
} elsif (/\G(naptr)[ \t]+/igc) {
# Parsing taken from Net::DNS::RR::NAPTR
- if (!/\G(\d+) \s+ (\d+) \s+ ['"] (.*?) ['"] \s+ ['"] (.*?) ['"] \s+ ['"] (.*?) ['"] \s+ (\S+)$/xgc) {
+ if (!/\G(\d+) \s+ (\d+) \s+ ['"] (.*?) ['"] \s+ ['"] (.*?) ['"] \s+ ['"] (.*?) ['"] \s+ ($pat_maybefullname)$pat_skip$/xgc) {
error("bad NAPTR data");
}
push @zone,
@@ -1108,7 +1108,7 @@ sub parse_line
regexp => $5,
replacement => $6,
};
- $zone[ $#zone ]{replacement} =~ s/\.+$//;
+ $zone[-1]{replacement} .= $origin unless $zone[-1]{replacement} =~ /\.$/;
} elsif (/\Gany\s+tsig.*$/igc) {
# XXX ignore tsigs
} else {
Cheers,
\Anton.
--
Our society can survive even a large amount of irrational regulation.
-- John McCarthy