diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 15 | ||||
-rw-r--r-- | tests/bind.conf | 126 | ||||
-rw-r--r-- | tests/bind.dlz | 33 | ||||
-rw-r--r-- | tests/bind.ext.conf | 25 | ||||
-rw-r--r-- | tests/bind.int.conf | 17 | ||||
-rw-r--r-- | tests/bind.keys | 11 | ||||
-rw-r--r-- | tests/gcffmt.c | 8 | ||||
-rw-r--r-- | tests/parser-bind.at | 95 | ||||
-rw-r--r-- | tests/testsuite.at | 1 |
9 files changed, 328 insertions, 3 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index f5d1f6f..1b47712 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -16,3 +16,15 @@ -EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 gcf1.conf meta1.conf git.conf +EXTRA_DIST = \ + $(TESTSUITE_AT)\ + testsuite\ + package.m4\ + gcf1.conf\ + bind.conf\ + bind.keys\ + bind.int.conf\ + bind.ext.conf\ + bind.dlz\ + meta1.conf\ + git.conf + DISTCLEANFILES = atconfig $(check_SCRIPTS) @@ -53,2 +65,3 @@ TESTSUITE_AT = \ join.at\ + parser-bind.at\ parser-git.at\ diff --git a/tests/bind.conf b/tests/bind.conf new file mode 100644 index 0000000..2579a58 --- /dev/null +++ b/tests/bind.conf @@ -0,0 +1,126 @@ +# Sample Bind configuration file for Grecs testsuite. +# Nothing to copyright, really:) + +acl upd-dyn-vpn { + key vpn.; + 10.11.0.1; + 10.10.0.1; +}; + +acl foo-acl { + key foo.; +}; + +options { + version "Grecs testsuite"; + coresize 0; + directory "/etc/namedb"; + pid-file "/var/log/bind/named.pid"; + allow-transfer { + foo-acl; + }; + allow-query { + any; + }; + serial-query-rate 5; + max-journal-size 5m; + check-names master warn; + check-names slave warn; + check-names response ignore; +}; + +logging { + channel default_channel { + file "/var/log/bind/named.log" versions 9 size 524288; + print-time yes; + print-severity yes; + }; + channel debug_channel { + file "/var/log/bind/named.run" versions 9 size 524288; + print-time yes; + print-severity yes; + severity dynamic; + }; + channel security_channel { + file "/var/log/bind/security" versions 9 size 524288; + print-time yes; + print-severity yes; + }; + channel xfer_in_channel { + file "/var/log/bind/named-xfer.in" versions 9 size 524288; + print-time yes; + }; + channel xfer_out_channel { + file "/var/log/bind/named-xfer.out" versions 9 size 524288; + print-time yes; + }; + channel lamers_channel { + file "/var/log/bind/lamers.log" versions 5 size 524288; + print-time yes; + print-category yes; + }; + channel update_channel { + file "/var/log/bind/update.log" versions 9 size 524288; + print-time yes; + print-category yes; + severity debug 5; + }; + channel notify_channel { + file "/var/log/bind/notify.log" versions 9 size 524288; + print-time yes; + print-category yes; + }; + channel query_channel { + file "/var/log/bind/query.log" versions 9 size 524288; + print-time yes; + }; + category security { + security_channel; + }; + category queries { +# query_channel; + null; + }; + category default { + default_channel; + debug_channel; + }; + category xfer-in { + xfer_in_channel; + }; + category xfer-out { + xfer_out_channel; + }; + category delegation-only { + lamers_channel; + }; + category lame-servers { + lamers_channel; + }; + category update { + update_channel; + }; + category notify { + notify_channel; + }; +}; + +include "bind.keys"; + +controls { + inet 127.0.0.1 port 953 + allow { 127.0.0.1; } keys { "rndc-key"; }; +}; + +view "internal" { + match-clients { + 10.0.0.0/8; + }; + include "bind.int.conf"; +}; + +view "external" { + include "bind.ext.conf"; + include "bind.dlz"; +}; +# Finis coronat opus diff --git a/tests/bind.dlz b/tests/bind.dlz new file mode 100644 index 0000000..ffbbfc9 --- /dev/null +++ b/tests/bind.dlz @@ -0,0 +1,33 @@ +# Sample Bind configuration include file (3) for Grecs testsuite. +# This is a typical (?) DLZ configuraton for BIND. +# +dlz "DLZ" { + database "mysql + {host=localhost socket=/var/run/mysql/mysql.sock dbname=Foo user=bind ssl=false} + {select r.zone from dns_soa r, dns_acl a where r.zone = '%zone%' + and a.network <= inet_aton('%client%') and inet_aton('%client%') <= + a.bcast + and a.view = r.view } + {select r.ttl, r.type, r.mx_priority, + case when r.type='TXT' then concat('\"', r.data, '\"') else r.data end + from dns_records r, dns_acl a, + where r.zone = '%zone%' and r.host = '%record%' + and not (r.type = 'SOA' or r.type = 'NS') + and a.network <= inet_aton('%client%') and inet_aton('%client%') <= + a.bcast + and a.view = r.view } + {select r.ttl, r.type, r.data, r.resp_person, r.serial, + r.refresh, r.retry, r.expire, r.minimum + from dns_soa r, dns_acl a where r.zone = '%zone%' + and (r.type = 'SOA' or r.type='NS') + and a.network <= inet_aton('%client%') and + inet_aton('%client%') <= a.bcast + and a.view = r.view } + {select r.ttl, r.type, r.host, r.mx_priority, case when r.type='TXT' then + concat('\"', r.data, '\"') else r.data end + from dns_records r, dns_acl a where r.zone = '%zone%' + and a.network <= inet_aton('%client%') and + inet_aton('%client%') <= a.bcast + and a.view = r.view } + {select zone from dns_xfr where zone = '%zone%' and client = '%client%'}"; +}; diff --git a/tests/bind.ext.conf b/tests/bind.ext.conf new file mode 100644 index 0000000..b18e8f6 --- /dev/null +++ b/tests/bind.ext.conf @@ -0,0 +1,25 @@ +# Sample Bind configuration include file (2) for Grecs testsuite. + +zone "." { + type hint; + file "named.root"; +}; + +zone "com" { + type delegation-only; +}; + +zone "net" { + type delegation-only; +}; + +zone "0.0.127.IN-ADDR.ARPA" { + type master; + file "local.p"; +}; + +zone "foo.example.net" { + type master; + file "foo.p"; +}; +
\ No newline at end of file diff --git a/tests/bind.int.conf b/tests/bind.int.conf new file mode 100644 index 0000000..faba329 --- /dev/null +++ b/tests/bind.int.conf @@ -0,0 +1,17 @@ +# Sample Bind configuration include file (2) for Grecs testsuite. + +zone "int" { + type master; + file "int.p"; + allow-update { + upd-dyn-vpn; + }; + allow-query { + internal-hosts; + }; + allow-transfer { + 10.11.0.1; + 10.10.0.4; + 127.0.0.1; + }; +};
\ No newline at end of file diff --git a/tests/bind.keys b/tests/bind.keys new file mode 100644 index 0000000..ba43779 --- /dev/null +++ b/tests/bind.keys @@ -0,0 +1,11 @@ +# Sample Bind configuration include file (1) for Grecs testsuite. + +key "rndc-key" { + algorithm hmac-md5; + secret "1111111111111111111111=="; +}; + + + + + diff --git a/tests/gcffmt.c b/tests/gcffmt.c index 51e3037..5dcd640 100644 --- a/tests/gcffmt.c +++ b/tests/gcffmt.c @@ -28,3 +28,3 @@ usage(const char *arg, FILE *fp, int code) "usage: %s [-h] [-locus] [-delim=char] [-reduce] [-sort] " - "[-type=grecs|bind|meta1|git] file [file...]\n", + "[-type=grecs|bind|meta1|git] [-Idir] [-include=dir] file [file...]\n", arg); @@ -72,3 +72,7 @@ main(int argc, char **argv) usage(progname, stderr, 1); - } else if (arg[0] == '-') + } else if (strncmp(arg, "-I", 2) == 0) + grecs_preproc_add_include_dir(arg+2); + else if (strncmp(arg, "-include=", 9) == 0) + grecs_preproc_add_include_dir(arg+9); + else if (arg[0] == '-') usage(progname, stderr, 1); diff --git a/tests/parser-bind.at b/tests/parser-bind.at new file mode 100644 index 0000000..b7ae3e1 --- /dev/null +++ b/tests/parser-bind.at @@ -0,0 +1,95 @@ +# This file is part of grecs -*- Autotest -*- +# Copyright (C) 2011 Sergey Poznyakoff +# +# Grecs is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# Grecs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Grecs. If not, see <http://www.gnu.org/licenses/>. + +AT_SETUP([BIND-style parser]) +AT_KEYWORDS([parser bind]) + +AT_CHECK([gcffmt -type=bind -I$abs_srcdir $abs_srcdir/bind.conf|sed 's/ *$//'], +[0], +[.acl="upd-dyn-vpn".key: "vpn." +.acl="upd-dyn-vpn".10.11.0.1: +.acl="upd-dyn-vpn".10.10.0.1: +.acl="foo-acl".key: "foo." +.options.version: "Grecs testsuite" +.options.coresize: "0" +.options.directory: "/etc/namedb" +.options.pid-file: "/var/log/bind/named.pid" +.options.allow-transfer.foo-acl: +.options.allow-query.any: +.options.serial-query-rate: "5" +.options.max-journal-size: "5m" +.options.check-names: "master" "warn" +.options.check-names: "slave" "warn" +.options.check-names: "response" "ignore" +.logging.channel="default_channel".file: "/var/log/bind/named.log" "versions" "9" "size" "524288" +.logging.channel="default_channel".print-time: "yes" +.logging.channel="default_channel".print-severity: "yes" +.logging.channel="debug_channel".file: "/var/log/bind/named.run" "versions" "9" "size" "524288" +.logging.channel="debug_channel".print-time: "yes" +.logging.channel="debug_channel".print-severity: "yes" +.logging.channel="debug_channel".severity: "dynamic" +.logging.channel="security_channel".file: "/var/log/bind/security" "versions" "9" "size" "524288" +.logging.channel="security_channel".print-time: "yes" +.logging.channel="security_channel".print-severity: "yes" +.logging.channel="xfer_in_channel".file: "/var/log/bind/named-xfer.in" "versions" "9" "size" "524288" +.logging.channel="xfer_in_channel".print-time: "yes" +.logging.channel="xfer_out_channel".file: "/var/log/bind/named-xfer.out" "versions" "9" "size" "524288" +.logging.channel="xfer_out_channel".print-time: "yes" +.logging.channel="lamers_channel".file: "/var/log/bind/lamers.log" "versions" "5" "size" "524288" +.logging.channel="lamers_channel".print-time: "yes" +.logging.channel="lamers_channel".print-category: "yes" +.logging.channel="update_channel".file: "/var/log/bind/update.log" "versions" "9" "size" "524288" +.logging.channel="update_channel".print-time: "yes" +.logging.channel="update_channel".print-category: "yes" +.logging.channel="update_channel".severity: "debug" "5" +.logging.channel="notify_channel".file: "/var/log/bind/notify.log" "versions" "9" "size" "524288" +.logging.channel="notify_channel".print-time: "yes" +.logging.channel="notify_channel".print-category: "yes" +.logging.channel="query_channel".file: "/var/log/bind/query.log" "versions" "9" "size" "524288" +.logging.channel="query_channel".print-time: "yes" +.logging.category="security".security_channel: +.logging.category="queries".null: +.logging.category="default".default_channel: +.logging.category="default".debug_channel: +.logging.category="xfer-in".xfer_in_channel: +.logging.category="xfer-out".xfer_out_channel: +.logging.category="delegation-only".lamers_channel: +.logging.category="lame-servers".lamers_channel: +.logging.category="update".update_channel: +.logging.category="notify".notify_channel: +.key="rndc-key".algorithm: "hmac-md5" +.key="rndc-key".secret: "1111111111111111111111==" +.controls.inet: "127.0.0.1" "port" "953" "allow" ("127.0.0.1") "keys" ("rndc-key") +.view="internal".match-clients.10.0.0.0/8: +.view="internal".zone="int".type: "master" +.view="internal".zone="int".file: "int.p" +.view="internal".zone="int".allow-update.upd-dyn-vpn: +.view="internal".zone="int".allow-query.internal-hosts: +.view="internal".zone="int".allow-transfer.10.11.0.1: +.view="internal".zone="int".allow-transfer.10.10.0.4: +.view="internal".zone="int".allow-transfer.127.0.0.1: +.view="external".zone=".".type: "hint" +.view="external".zone=".".file: "named.root" +.view="external".zone="com".type: "delegation-only" +.view="external".zone="net".type: "delegation-only" +.view="external".zone="0.0.127.IN-ADDR.ARPA".type: "master" +.view="external".zone="0.0.127.IN-ADDR.ARPA".file: "local.p" +.view="external".zone="foo.example.net".type: "master" +.view="external".zone="foo.example.net".file: "foo.p" +.view="external".dlz="DLZ".database: "mysql\n {host=localhost socket=/var/run/mysql/mysql.sock dbname=Foo user=bind ssl=false}\n {select r.zone from dns_soa r, dns_acl a where r.zone = '%zone%'\n and a.network <= inet_aton('%client%') and inet_aton('%client%') <=\n a.bcast\n and a.view = r.view }\n {select r.ttl, r.type, r.mx_priority,\n case when r.type='TXT' then concat('\"', r.data, '\"') else r.data end\n from dns_records r, dns_acl a,\n where r.zone = '%zone%' and r.host = '%record%'\n and not (r.type = 'SOA' or r.type = 'NS')\n and a.network <= inet_aton('%client%') and inet_aton('%client%') <=\n a.bcast\n and a.view = r.view }\n {select r.ttl, r.type, r.data, r.resp_person, r.serial,\n r.refresh, r.retry, r.expire, r.minimum\n from dns_soa r, dns_acl a where r.zone = '%zone%'\n and (r.type = 'SOA' or r.type='NS')\n and a.network <= inet_aton('%client%') and\n inet_aton('%client%') <= a.bcast\n and a.view = r.view }\n {select r.ttl, r.type, r.host, r.mx_priority, case when r.type='TXT' then\n concat('\"', r.data, '\"') else r.data end\n from dns_records r, dns_acl a where r.zone = '%zone%' \n and a.network <= inet_aton('%client%') and\n inet_aton('%client%') <= a.bcast\n and a.view = r.view }\n {select zone from dns_xfr where zone = '%zone%' and client = '%client%'}" +]) + +AT_CLEANUP diff --git a/tests/testsuite.at b/tests/testsuite.at index b81b45e..5b4c9a4 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -75,2 +75,3 @@ m4_include([join.at]) +m4_include([parser-bind.at]) m4_include([parser-git.at]) |