1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
Description: Bind 9 compatibility
Author: Ivan Kohler <ivan@debian.org>
Bug: https://rt.cpan.org/Ticket/Display.html?id=82217
Forwarded: https://rt.cpan.org/Ticket/Display.html?id=82217
Reviewed-By: Xavier Guimard <x.guimard@free.fr>
Last-Update: 2012-12-22
--- a/README
+++ b/README
@@ -3,12 +3,12 @@
DESCRIPTION
This module allows a script to understand the contents of a BIND
- version 8 named.conf file. Why would you want to parse your
- /etc/named.conf file? Well, let's say you're a sysadmin and you've
- gotten tired of mismatches between your DNS forward and reverse
- zones, and you want a tool that'll check your zone files for
- inconsistencies and typos. How's that tool going to get the
- complete list of zone files? Tah da, enter this module, stage
+ version 8 (and sometimes version 9) named.conf file. Why would you
+ want to parse your /etc/named.conf file? Well, let's say you're a
+ sysadmin and you've gotten tired of mismatches between your DNS
+ forward and reverse zones, and you want a tool that'll check your
+ zone files for inconsistencies and typos. How's that tool going to
+ get the complete list of zone files? Tah da, enter this module, stage
right! The verify_zones script included with this module does
exactly the above, and may even work at your site.
@@ -19,7 +19,9 @@
The name of this module is perhaps not the best. Suggestions
are welcome.
- This revision matches BIND version 8.2.2.
+ This revision matches BIND version 8.2.2. Some capability to not
+ throw fatal exceptions when parsing version 9 configuration files
+ has been added, but it is far from complete.
THANKS
The design of this module was inspired by Gisle Aas's HTML::Parser
@@ -56,5 +58,7 @@
ftp://ftp.gac.edu/pub/guenther/BIND-Conf_Parser-0.95.tar.gz
AUTHOR
- BIND-Conf_Parser was created by Philip Guenther <guenther@gac.edu>
+ BIND-Conf_Parser was created by Philip Guenther <guenther@gac.edu>.
+ Some very preliminary changes were made to parse a few version 9
+ configuration files by Ivan Kohler <ivan-bind-confparser@420.am>.
--- a/lib/BIND/Conf_Parser.pm
+++ b/lib/BIND/Conf_Parser.pm
@@ -427,6 +427,20 @@
$self->expect(';', "to finish logging declaration");
}
+sub parse_listen_on($$) {
+ my($self, $mess) = @_;
+ $self->expect([ [ 'port' ], '{' ], $mess);
+ my($port);
+ if ($self->{_token} eq WORD) {
+ $self->expect(NUMBER, "following `port'");
+ $port = 0 + $self->{_data};
+ $self->expect('{', $mess);
+ } else {
+ $port = 53;
+ }
+ return [$port, $self->parse_addrmatchlist($mess, 1)];
+}
+
my(%opt_table) = (
"version" => STRING,
"directory" => STRING,
@@ -470,19 +484,8 @@
"allow-transfer" => \&parse_addrmatchlist,
"allow-recursion" => \&parse_addrmatchlist,
"blackhole" => \&parse_addrmatchlist,
- "listen-on" => sub {
- my($self, $mess) = @_;
- $self->expect([ [ 'port' ], '{' ], $mess);
- my($port);
- if ($self->{_token} eq WORD) {
- $self->expect(NUMBER, "following `port'");
- $port = 0 + $self->{_data};
- $self->expect('{', $mess);
- } else {
- $port = 53;
- }
- return [$port, $self->parse_addrmatchlist($mess, 1)];
- },
+ "listen-on" => \&parse_listen_on,
+ "listen-on-v6" => \&parse_listen_on,
"query-source" => sub {
my($self, $mess) = @_;
my($port, $address) = (0, 0);
@@ -935,10 +938,10 @@
=head1 DESCRIPTION
C<BIND::Conf_Parser> implements a virtual base class for parsing BIND
-(Berkeley Internet Name Domain) server version 8 configuration files
-("named.conf"). The parsing methods shown in the synopsis perform
-syntactic analysis only. As each meaningful semantic 'chunk' is
-parsed, a callback method is invoked with the parsed information.
+(Berkeley Internet Name Domain) server version 8 (and sometimes version 9)
+configuration files ("named.conf"). The parsing methods shown in the
+synopsis perform syntactic analysis only. As each meaningful semantic
+'chunk' is parsed, a callback method is invoked with the parsed information.
The following methods are the public entry points for the base class:
=over 4
@@ -1065,7 +1068,9 @@
and understands the statements, options, and forms of that version.
Since the BIND developers have only made upward compatible changes to
the syntax, C<BIND::Conf_Parser> will correctly parse valid config files
-for previous versions of BIND.
+for previous versions of BIND. Some support for simple version 9
+configuration files has been added, but there are probably new statements
+that are not yet recognized.
A C<BIND::Conf_Parser> object is a blessed anonymous hash. In an
attempt to prevent modules trampling on each other I propose that any
|