diff options
author | Internet Software Consortium, Inc <@isc.org> | 2007-09-07 14:11:04 -0600 |
---|---|---|
committer | LaMont Jones <lamont@debian.org> | 2007-09-07 14:11:04 -0600 |
commit | 4dd5eedee98c3fc2f40a45078bc7006cd5efd7f0 (patch) | |
tree | 85b4b951eb54c6a7d489139cdc8f8a0b1fb87eeb /bin/check | |
parent | e71238b670ee683d2177c93695465bb6b181c4b8 (diff) | |
download | bind9-4dd5eedee98c3fc2f40a45078bc7006cd5efd7f0.tar.gz |
9.2.0a1
Diffstat (limited to 'bin/check')
-rw-r--r-- | bin/check/Makefile.in | 37 | ||||
-rw-r--r-- | bin/check/check-tool.c | 6 | ||||
-rw-r--r-- | bin/check/check-tool.h | 2 | ||||
-rw-r--r-- | bin/check/named-checkconf.8 | 48 | ||||
-rw-r--r-- | bin/check/named-checkconf.c | 102 | ||||
-rw-r--r-- | bin/check/named-checkconf.docbook | 114 | ||||
-rw-r--r-- | bin/check/named-checkconf.html | 182 | ||||
-rw-r--r-- | bin/check/named-checkzone.8 | 58 | ||||
-rw-r--r-- | bin/check/named-checkzone.c | 26 | ||||
-rw-r--r-- | bin/check/named-checkzone.docbook | 145 | ||||
-rw-r--r-- | bin/check/named-checkzone.html | 213 |
11 files changed, 873 insertions, 60 deletions
diff --git a/bin/check/Makefile.in b/bin/check/Makefile.in index 8d036aa8..f9e22297 100644 --- a/bin/check/Makefile.in +++ b/bin/check/Makefile.in @@ -13,7 +13,7 @@ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.5.2.1 2001/01/09 22:31:13 bwelling Exp $ +# $Id: Makefile.in,v 1.12.2.1 2001/06/01 00:46:22 bwelling Exp $ srcdir = @srcdir@ VPATH = @srcdir@ @@ -21,15 +21,17 @@ top_srcdir = @top_srcdir@ @BIND9_INCLUDES@ -CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} +CINCLUDES = ${DNS_INCLUDES} ${ISCCFG_INCLUDES} ${ISC_INCLUDES} -CDEFINES = +CDEFINES = -DNS_SYSCONFDIR=\"${sysconfdir}\" CWARNINGS = DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_OPENSSL_LIBS@ @DNS_GSSAPI_LIBS@ +ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ ISCLIBS = ../../lib/isc/libisc.@A@ DNSDEPLIBS = ../../lib/dns/libdns.@A@ +ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@ ISCDEPLIBS = ../../lib/isc/libisc.@A@ LIBS = @LIBS@ @@ -42,22 +44,35 @@ TARGETS = named-checkconf named-checkzone # Alphabetically SRCS = named-checkconf.c named-checkzone.c check-tool.c +MANPAGES = named-checkconf.8 named-checkzone.8 + +HTMLPAGES = named-checkconf.html named-checkzone.html + +MANOBJS = ${MANPAGES} ${HTMLPAGES} + @BIND9_MAKE_RULES@ -named-checkconf: named-checkconf.@O@ check-tool.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} - ${LIBTOOL} ${CC} ${CFLAGS} -o $@ named-checkconf.@O@ check-tool.@O@ \ - ${DNSLIBS} ${ISCLIBS} ${LIBS} +named-checkconf: named-checkconf.@O@ check-tool.@O@ ${ISCDEPLIBS} ${ISCCFGDEPLIBS} + ${LIBTOOL} ${PURIFY} ${CC} ${CFLAGS} -o $@ named-checkconf.@O@ \ + check-tool.@O@ ${ISCCFGLIBS} ${ISCLIBS} ${LIBS} named-checkzone: named-checkzone.@O@ check-tool.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} - ${LIBTOOL} ${CC} ${CFLAGS} -o $@ named-checkzone.@O@ check-tool.@O@ \ - ${DNSLIBS} ${ISCLIBS} ${LIBS} + ${LIBTOOL} ${PURIFY} ${CC} ${CFLAGS} -o $@ named-checkzone.@O@ \ + check-tool.@O@ ${DNSLIBS} ${ISCLIBS} ${LIBS} -clean distclean:: - rm -f ${TARGETS} +doc man:: ${MANOBJS} + +docclean manclean maintainer-clean:: + rm -f ${MANOBJS} installdirs: $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir} + $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8 -install:: named-checkconf named-checkzone +install:: named-checkconf named-checkzone installdirs ${LIBTOOL} ${INSTALL_PROGRAM} named-checkconf ${DESTDIR}${sbindir} ${LIBTOOL} ${INSTALL_PROGRAM} named-checkzone ${DESTDIR}${sbindir} + for m in ${MANPAGES}; do ${INSTALL_DATA} ${srcdir}/$$m ${DESTDIR}${mandir}/man8; done + +clean distclean:: + rm -f ${TARGETS} diff --git a/bin/check/check-tool.c b/bin/check/check-tool.c index 8be36e62..dd3fec64 100644 --- a/bin/check/check-tool.c +++ b/bin/check/check-tool.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: check-tool.c,v 1.2.2.1 2001/01/09 22:31:14 bwelling Exp $ */ +/* $Id: check-tool.c,v 1.4 2001/03/03 23:11:33 bwelling Exp $ */ #include <config.h> @@ -27,8 +27,6 @@ #include <isc/log.h> #include <isc/types.h> -#include <dns/log.h> - isc_result_t setup_logging(isc_mem_t *mctx, isc_log_t **logp) { isc_logdestination_t destination; @@ -37,8 +35,6 @@ setup_logging(isc_mem_t *mctx, isc_log_t **logp) { RUNTIME_CHECK(isc_log_create(mctx, &log, &logconfig) == ISC_R_SUCCESS); isc_log_setcontext(log); - dns_log_init(log); - dns_log_setcontext(log); destination.file.stream = stdout; destination.file.name = NULL; diff --git a/bin/check/check-tool.h b/bin/check/check-tool.h index 7b2454d0..17a68b23 100644 --- a/bin/check/check-tool.h +++ b/bin/check/check-tool.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: check-tool.h,v 1.1.2.1 2001/01/09 22:31:15 bwelling Exp $ */ +/* $Id: check-tool.h,v 1.2 2001/01/09 21:39:09 bwelling Exp $ */ #ifndef CHECK_TOOL_H #define CHECK_TOOL_H diff --git a/bin/check/named-checkconf.8 b/bin/check/named-checkconf.8 new file mode 100644 index 00000000..3450f3ba --- /dev/null +++ b/bin/check/named-checkconf.8 @@ -0,0 +1,48 @@ +.\" Copyright (C) 2000, 2001 Internet Software Consortium. +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM +.\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL +.\" INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, +.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING +.\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION +.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +.\" $Id: named-checkconf.8,v 1.8 2001/05/30 20:30:10 bwelling Exp $ + +.TH "NAMED-CHECKCONF" "8" "June 14, 2000" "BIND9" "" +.SH NAME +named-checkconf \- named configuration file syntax checking tool +.SH SYNOPSIS +.sp +\fBnamed-checkconf\fR [ \fB-t \fIdirectory\fB\fR ] \fBfilename\fR +.SH "DESCRIPTION" +.PP +\fBnamed-checkconf\fR checks the syntax, but not +the semantics, of a named configuration file. +.SH "OPTIONS" +.TP +\fB-t \fIdirectory\fB\fR +chroot to \fIdirectory\fR so that include +directives in the configuration file are processed as if +run by a similarly chrooted named. +.TP +\fBfilename\fR +The name of the configuration file to be checked. If not +specified, it defaults to \fI/etc/named.conf\fR. +.SH "RETURN VALUES" +.PP +\fBnamed-checkconf\fR returns an exit status of 1 if +errors were detected and 0 otherwise. +.SH "SEE ALSO" +.PP +\fBnamed\fR(8), +\fIBIND 9 Administrator Reference Manual\fR. +.SH "AUTHOR" +.PP +Internet Software Consortium diff --git a/bin/check/named-checkconf.c b/bin/check/named-checkconf.c index 9066dc0d..bd38a8d1 100644 --- a/bin/check/named-checkconf.c +++ b/bin/check/named-checkconf.c @@ -15,69 +15,113 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: named-checkconf.c,v 1.2.2.1 2001/01/09 22:31:16 bwelling Exp $ */ +/* $Id: named-checkconf.c,v 1.8 2001/05/18 23:50:04 gson Exp $ */ #include <config.h> #include <errno.h> #include <stdlib.h> +#include <stdio.h> +#include <isc/commandline.h> +#include <isc/dir.h> +#include <isc/log.h> #include <isc/mem.h> +#include <isc/result.h> #include <isc/string.h> #include <isc/util.h> -#include <dns/log.h> -#include <dns/namedconf.h> +#include <isccfg/cfg.h> +#include <isccfg/check.h> #include "check-tool.h" -static isc_result_t -zonecbk(dns_c_ctx_t *ctx, dns_c_zone_t *zone, dns_c_view_t *view, void *uap) { - - UNUSED(ctx); - UNUSED(uap); - UNUSED(zone); - UNUSED(view); +isc_log_t *log = NULL; - return (ISC_R_SUCCESS); +static void +usage(void) { + fprintf(stderr, "usage: named-checkconf [-t directory] [named.conf]\n"); + exit(1); } static isc_result_t -optscbk(dns_c_ctx_t *ctx, void *uap) { - UNUSED(ctx); - UNUSED(uap); +directory_callback(const char *clausename, cfg_obj_t *obj, void *arg) { + isc_result_t result; + char *directory; + + REQUIRE(strcasecmp("directory", clausename) == 0); + + UNUSED(arg); + UNUSED(clausename); + + /* + * Change directory. + */ + directory = cfg_obj_asstring(obj); + result = isc_dir_chdir(directory); + if (result != ISC_R_SUCCESS) { + cfg_obj_log(obj, log, ISC_LOG_ERROR, + "change directory to '%s' failed: %s", + directory, isc_result_totext(result)); + return (result); + } return (ISC_R_SUCCESS); } int main(int argc, char **argv) { - dns_c_ctx_t *configctx = NULL; + int c; + cfg_parser_t *parser = NULL; + cfg_obj_t *config = NULL; const char *conffile = NULL; isc_mem_t *mctx = NULL; - dns_c_cbks_t callbacks; - isc_log_t *log = NULL; - - callbacks.zonecbk = zonecbk; - callbacks.optscbk = optscbk; - callbacks.zonecbkuap = NULL; - callbacks.optscbkuap = NULL; + isc_result_t result; + + while ((c = isc_commandline_parse(argc, argv, "t:")) != EOF) { + switch (c) { + case 't': + result = isc_dir_chroot(isc_commandline_argument); + if (result != ISC_R_SUCCESS) { + fprintf(stderr, "isc_dir_chroot: %s\n", + isc_result_totext(result)); + exit(1); + } + result = isc_dir_chdir("/"); + if (result != ISC_R_SUCCESS) { + fprintf(stderr, "isc_dir_chdir: %s\n", + isc_result_totext(result)); + exit(1); + } + break; + + default: + usage(); + } + } - if (argc > 1) - conffile = argv[1]; + if (argv[isc_commandline_index] != NULL) + conffile = argv[isc_commandline_index]; if (conffile == NULL || conffile[0] == '\0') - conffile = "/etc/named.conf"; + conffile = NS_SYSCONFDIR "/named.conf"; RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(setup_logging(mctx, &log) == ISC_R_SUCCESS); - if (dns_c_parse_namedconf(conffile, mctx, &configctx, &callbacks) != - ISC_R_SUCCESS) { + RUNTIME_CHECK(cfg_parser_create(mctx, log, &parser) == ISC_R_SUCCESS); + + cfg_parser_setcallback(parser, directory_callback, NULL); + + if (cfg_parse_file(parser, conffile, &cfg_type_namedconf, &config) != + ISC_R_SUCCESS) exit(1); - } - dns_c_ctx_delete(&configctx); + RUNTIME_CHECK(cfg_check_namedconf(config, log, mctx) == ISC_R_SUCCESS); + + cfg_obj_destroy(parser, &config); + + cfg_parser_destroy(&parser); isc_log_destroy(&log); diff --git a/bin/check/named-checkconf.docbook b/bin/check/named-checkconf.docbook new file mode 100644 index 00000000..f0867a17 --- /dev/null +++ b/bin/check/named-checkconf.docbook @@ -0,0 +1,114 @@ +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"> +<!-- + - Copyright (C) 2001 Internet Software Consortium. + - + - Permission to use, copy, modify, and distribute this software for any + - purpose with or without fee is hereby granted, provided that the above + - copyright notice and this permission notice appear in all copies. + - + - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM + - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL + - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, + - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +--> + +<!-- $Id: named-checkconf.docbook,v 1.2 2001/04/10 21:50:19 bwelling Exp $ --> + +<refentry> + <refentryinfo> + <date>June 14, 2000</date> + </refentryinfo> + + <refmeta> + <refentrytitle><application>named-checkconf</application></refentrytitle> + <manvolnum>8</manvolnum> + <refmiscinfo>BIND9</refmiscinfo> + </refmeta> + + <refnamediv> + <refname><application>named-checkconf</application></refname> + <refpurpose>named configuration file syntax checking tool</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <cmdsynopsis> + <command>named-checkconf</command> + <arg><option>-t <replaceable class="parameter">directory</replaceable></option></arg> + <arg choice="req">filename</arg> + </cmdsynopsis> + </refsynopsisdiv> + + <refsect1> + <title>DESCRIPTION</title> + <para> + <command>named-checkconf</command> checks the syntax, but not + the semantics, of a named configuration file. + </para> + </refsect1> + + <refsect1> + <title>OPTIONS</title> + + <variablelist> + <varlistentry> + <term>-t <replaceable class="parameter">directory</replaceable></term> + <listitem> + <para> + chroot to <filename>directory</filename> so that include + directives in the configuration file are processed as if + run by a similarly chrooted named. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>filename</term> + <listitem> + <para> + The name of the configuration file to be checked. If not + specified, it defaults to <filename>/etc/named.conf</filename>. + </para> + </listitem> + </varlistentry> + + </variablelist> + + </refsect1> + + <refsect1> + <title>RETURN VALUES</title> + <para> + <command>named-checkconf</command> returns an exit status of 1 if + errors were detected and 0 otherwise. + </refsect1> + + <refsect1> + <title>SEE ALSO</title> + <para> + <citerefentry> + <refentrytitle>named</refentrytitle> + <manvolnum>8</manvolnum> + </citerefentry>, + <citetitle>BIND 9 Administrator Reference Manual</citetitle>. + </para> + </refsect1> + + <refsect1> + <title>AUTHOR</title> + <para> + <corpauthor>Internet Software Consortium</corpauthor> + </para> + </refsect1> + +</refentry> + +<!-- + - Local variables: + - mode: sgml + - End: +--> + diff --git a/bin/check/named-checkconf.html b/bin/check/named-checkconf.html new file mode 100644 index 00000000..5084086a --- /dev/null +++ b/bin/check/named-checkconf.html @@ -0,0 +1,182 @@ +<!-- + - Copyright (C) 2001 Internet Software Consortium. + - + - Permission to use, copy, modify, and distribute this software for any + - purpose with or without fee is hereby granted, provided that the above + - copyright notice and this permission notice appear in all copies. + - + - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM + - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL + - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, + - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +--> + +<!-- $Id: named-checkconf.html,v 1.2 2001/04/10 21:50:20 bwelling Exp $ --> + +<HTML +><HEAD +><TITLE +>named-checkconf</TITLE +><META +NAME="GENERATOR" +CONTENT="Modular DocBook HTML Stylesheet Version 1.61 +"></HEAD +><BODY +CLASS="REFENTRY" +BGCOLOR="#FFFFFF" +TEXT="#000000" +LINK="#0000FF" +VLINK="#840084" +ALINK="#0000FF" +><H1 +><A +NAME="AEN1" +><SPAN +CLASS="APPLICATION" +>named-checkconf</SPAN +></A +></H1 +><DIV +CLASS="REFNAMEDIV" +><A +NAME="AEN9" +></A +><H2 +>Name</H2 +><SPAN +CLASS="APPLICATION" +>named-checkconf</SPAN +> -- named configuration file syntax checking tool</DIV +><DIV +CLASS="REFSYNOPSISDIV" +><A +NAME="AEN13" +></A +><H2 +>Synopsis</H2 +><P +><B +CLASS="COMMAND" +>named-checkconf</B +> [<TT +CLASS="OPTION" +>-t <TT +CLASS="REPLACEABLE" +><I +>directory</I +></TT +></TT +>] {filename}</P +></DIV +><DIV +CLASS="REFSECT1" +><A +NAME="AEN20" +></A +><H2 +>DESCRIPTION</H2 +><P +> <B +CLASS="COMMAND" +>named-checkconf</B +> checks the syntax, but not + the semantics, of a named configuration file. + </P +></DIV +><DIV +CLASS="REFSECT1" +><A +NAME="AEN24" +></A +><H2 +>OPTIONS</H2 +><P +></P +><DIV +CLASS="VARIABLELIST" +><DL +><DT +>-t <TT +CLASS="REPLACEABLE" +><I +>directory</I +></TT +></DT +><DD +><P +> chroot to <TT +CLASS="FILENAME" +>directory</TT +> so that include + directives in the configuration file are processed as if + run by a similarly chrooted named. + </P +></DD +><DT +>filename</DT +><DD +><P +> The name of the configuration file to be checked. If not + specified, it defaults to <TT +CLASS="FILENAME" +>/etc/named.conf</TT +>. + </P +></DD +></DL +></DIV +></DIV +><DIV +CLASS="REFSECT1" +><A +NAME="AEN38" +></A +><H2 +>RETURN VALUES</H2 +><P +> <B +CLASS="COMMAND" +>named-checkconf</B +> returns an exit status of 1 if + errors were detected and 0 otherwise. + </P +></DIV +><DIV +CLASS="REFSECT1" +><A +NAME="AEN42" +></A +><H2 +>SEE ALSO</H2 +><P +> <SPAN +CLASS="CITEREFENTRY" +><SPAN +CLASS="REFENTRYTITLE" +>named</SPAN +>(8)</SPAN +>, + <I +CLASS="CITETITLE" +>BIND 9 Administrator Reference Manual</I +>. + </P +></DIV +><DIV +CLASS="REFSECT1" +><A +NAME="AEN49" +></A +><H2 +>AUTHOR</H2 +><P +> Internet Software Consortium + </P +></DIV +></BODY +></HTML +>
\ No newline at end of file diff --git a/bin/check/named-checkzone.8 b/bin/check/named-checkzone.8 new file mode 100644 index 00000000..9a943685 --- /dev/null +++ b/bin/check/named-checkzone.8 @@ -0,0 +1,58 @@ +.\" Copyright (C) 2000, 2001 Internet Software Consortium. +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM +.\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL +.\" INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, +.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING +.\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION +.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +.\" $Id: named-checkzone.8,v 1.8 2001/05/30 20:30:11 bwelling Exp $ + +.TH "NAMED-CHECKZONE" "8" "June 13, 2000" "BIND9" "" +.SH NAME +named-checkzone \- zone file validity checking tool +.SH SYNOPSIS +.sp +\fBnamed-checkzone\fR [ \fB-d\fR ] [ \fB-q\fR ] [ \fB-c \fIclass\fB\fR ] \fBzonename\fR \fBfilename\fR +.SH "DESCRIPTION" +.PP +\fBnamed-checkzone\fR checks the syntax and integrity of +a zone file. It performs the same checks as \fBnamed\fR +does when loading a zone. This makes +\fBnamed-checkzone\fR useful for checking zone +files before configuring them into a name server. +.SH "OPTIONS" +.TP +\fB-d\fR +Enable debugging. +.TP +\fB-q\fR +Quiet mode - exit code only. +.TP +\fB-c \fIclass\fB\fR +Specify the class of the zone. If not specified "IN" is assumed. +.TP +\fBzonename\fR +The domain name of the zone being checked. +.TP +\fBfilename\fR +The name of the zone file. +.SH "RETURN VALUES" +.PP +\fBnamed-checkzone\fR returns an exit status of 1 if +errors were detected and 0 otherwise. +.SH "SEE ALSO" +.PP +\fBnamed\fR(8), +\fIRFC 1035\fR, +\fIBIND 9 Administrator Reference Manual\fR. +.SH "AUTHOR" +.PP +Internet Software Consortium diff --git a/bin/check/named-checkzone.c b/bin/check/named-checkzone.c index c49c7593..a782a9f1 100644 --- a/bin/check/named-checkzone.c +++ b/bin/check/named-checkzone.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: named-checkzone.c,v 1.6.2.2 2001/01/11 18:30:28 gson Exp $ */ +/* $Id: named-checkzone.c,v 1.12 2001/03/03 23:11:36 bwelling Exp $ */ #include <config.h> @@ -61,7 +61,7 @@ static const char *dbtype[] = { "rbt" }; static void usage(void) { fprintf(stderr, - "usage: named-checkzone [-dq] [-c class] zone [filename]\n"); + "usage: named-checkzone [-dq] [-c class] zonename filename\n"); exit(1); } @@ -105,6 +105,7 @@ setup(char *zonename, char *filename, char *classname) { ERRRET(result, "dns_rdataclass_fromtext"); dns_zone_setclass(zone, rdclass); + dns_zone_setoption(zone, DNS_ZONEOPT_MANYERRORS, ISC_TRUE); result = dns_zone_load(zone); @@ -122,12 +123,10 @@ main(int argc, char **argv) { int c; char *origin = NULL; char *filename = NULL; - char *classname; isc_log_t *lctx = NULL; isc_result_t result; char classname_in[] = "IN"; - - classname = classname_in; + char *classname = classname_in; while ((c = isc_commandline_parse(argc, argv, "c:dqs")) != EOF) { switch (c) { @@ -145,20 +144,19 @@ main(int argc, char **argv) { } } - if (argv[isc_commandline_index] == NULL) + if (isc_commandline_index + 2 > argc) usage(); RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); - if (!quiet) + if (!quiet) { RUNTIME_CHECK(setup_logging(mctx, &lctx) == ISC_R_SUCCESS); + dns_log_init(lctx); + dns_log_setcontext(lctx); + } - origin = argv[isc_commandline_index]; - isc_commandline_index++; - if (argv[isc_commandline_index] != NULL) - filename = argv[isc_commandline_index]; - else - filename = origin; - result = setup(origin, filename, (char *)classname); + origin = argv[isc_commandline_index++]; + filename = argv[isc_commandline_index++]; + result = setup(origin, filename, classname); if (!quiet && result == ISC_R_SUCCESS) fprintf(stdout, "OK\n"); destroy(); diff --git a/bin/check/named-checkzone.docbook b/bin/check/named-checkzone.docbook new file mode 100644 index 00000000..e3a5b48a --- /dev/null +++ b/bin/check/named-checkzone.docbook @@ -0,0 +1,145 @@ +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"> +<!-- + - Copyright (C) 2001 Internet Software Consortium. + - + - Permission to use, copy, modify, and distribute this software for any + - purpose with or without fee is hereby granted, provided that the above + - copyright notice and this permission notice appear in all copies. + - + - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM + - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL + - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, + - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +--> + +<!-- $Id: named-checkzone.docbook,v 1.2 2001/04/10 21:50:22 bwelling Exp $ --> + +<refentry> + <refentryinfo> + <date>June 13, 2000</date> + </refentryinfo> + + <refmeta> + <refentrytitle><application>named-checkzone</application></refentrytitle> + <manvolnum>8</manvolnum> + <refmiscinfo>BIND9</refmiscinfo> + </refmeta> + + <refnamediv> + <refname><application>named-checkzone</application></refname> + <refpurpose>zone file validity checking tool</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <cmdsynopsis> + <command>named-checkzone</command> + <arg><option>-d</option></arg> + <arg><option>-q</option></arg> + <arg><option>-c <replaceable class="parameter">class</replaceable></option></arg> + <arg choice="req">zonename</arg> + <arg choice="req">filename</arg> + </cmdsynopsis> + </refsynopsisdiv> + + <refsect1> + <title>DESCRIPTION</title> + <para> + <command>named-checkzone</command> checks the syntax and integrity of + a zone file. It performs the same checks as <command>named</command> + does when loading a zone. This makes + <command>named-checkzone</command> useful for checking zone + files before configuring them into a name server. + </para> + </refsect1> + + <refsect1> + <title>OPTIONS</title> + + <variablelist> + <varlistentry> + <term>-d</term> + <listitem> + <para> + Enable debugging. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>-q</term> + <listitem> + <para> + Quiet mode - exit code only. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>-c <replaceable class="parameter">class</replaceable></term> + <listitem> + <para> + Specify the class of the zone. If not specified "IN" is assumed. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>zonename</term> + <listitem> + <para> + The domain name of the zone being checked. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>filename</term> + <listitem> + <para> + The name of the zone file. + </para> + </listitem> + </varlistentry> + + </variablelist> + + </refsect1> + + <refsect1> + <title>RETURN VALUES</title> + <para> + <command>named-checkzone</command> returns an exit status of 1 if + errors were detected and 0 otherwise. + </refsect1> + + <refsect1> + <title>SEE ALSO</title> + <para> + <citerefentry> + <refentrytitle>named</refentrytitle> + <manvolnum>8</manvolnum> + </citerefentry>, + <citetitle>RFC 1035</citetitle>, + <citetitle>BIND 9 Administrator Reference Manual</citetitle>. + </para> + </refsect1> + + <refsect1> + <title>AUTHOR</title> + <para> + <corpauthor>Internet Software Consortium</corpauthor> + </para> + </refsect1> + +</refentry> + +<!-- + - Local variables: + - mode: sgml + - End: +--> + diff --git a/bin/check/named-checkzone.html b/bin/check/named-checkzone.html new file mode 100644 index 00000000..5e2824bd --- /dev/null +++ b/bin/check/named-checkzone.html @@ -0,0 +1,213 @@ +<!-- + - Copyright (C) 2001 Internet Software Consortium. + - + - Permission to use, copy, modify, and distribute this software for any + - purpose with or without fee is hereby granted, provided that the above + - copyright notice and this permission notice appear in all copies. + - + - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM + - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL + - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, + - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +--> + +<!-- $Id: named-checkzone.html,v 1.2 2001/04/10 21:50:24 bwelling Exp $ --> + +<HTML +><HEAD +><TITLE +>named-checkzone</TITLE +><META +NAME="GENERATOR" +CONTENT="Modular DocBook HTML Stylesheet Version 1.61 +"></HEAD +><BODY +CLASS="REFENTRY" +BGCOLOR="#FFFFFF" +TEXT="#000000" +LINK="#0000FF" +VLINK="#840084" +ALINK="#0000FF" +><H1 +><A +NAME="AEN1" +><SPAN +CLASS="APPLICATION" +>named-checkzone</SPAN +></A +></H1 +><DIV +CLASS="REFNAMEDIV" +><A +NAME="AEN9" +></A +><H2 +>Name</H2 +><SPAN +CLASS="APPLICATION" +>named-checkzone</SPAN +> -- zone file validity checking tool</DIV +><DIV +CLASS="REFSYNOPSISDIV" +><A +NAME="AEN13" +></A +><H2 +>Synopsis</H2 +><P +><B +CLASS="COMMAND" +>named-checkzone</B +> [<TT +CLASS="OPTION" +>-d</TT +>] [<TT +CLASS="OPTION" +>-q</TT +>] [<TT +CLASS="OPTION" +>-c <TT +CLASS="REPLACEABLE" +><I +>class</I +></TT +></TT +>] {zonename} {filename}</P +></DIV +><DIV +CLASS="REFSECT1" +><A +NAME="AEN25" +></A +><H2 +>DESCRIPTION</H2 +><P +> <B +CLASS="COMMAND" +>named-checkzone</B +> checks the syntax and integrity of + a zone file. It performs the same checks as <B +CLASS="COMMAND" +>named</B +> + does when loading a zone. This makes + <B +CLASS="COMMAND" +>named-checkzone</B +> useful for checking zone + files before configuring them into a name server. + </P +></DIV +><DIV +CLASS="REFSECT1" +><A +NAME="AEN31" +></A +><H2 +>OPTIONS</H2 +><P +></P +><DIV +CLASS="VARIABLELIST" +><DL +><DT +>-d</DT +><DD +><P +> Enable debugging. + </P +></DD +><DT +>-q</DT +><DD +><P +> Quiet mode - exit code only. + </P +></DD +><DT +>-c <TT +CLASS="REPLACEABLE" +><I +>class</I +></TT +></DT +><DD +><P +> Specify the class of the zone. If not specified "IN" is assumed. + </P +></DD +><DT +>zonename</DT +><DD +><P +> The domain name of the zone being checked. + </P +></DD +><DT +>filename</DT +><DD +><P +> The name of the zone file. + </P +></DD +></DL +></DIV +></DIV +><DIV +CLASS="REFSECT1" +><A +NAME="AEN55" +></A +><H2 +>RETURN VALUES</H2 +><P +> <B +CLASS="COMMAND" +>named-checkzone</B +> returns an exit status of 1 if + errors were detected and 0 otherwise. + </P +></DIV +><DIV +CLASS="REFSECT1" +><A +NAME="AEN59" +></A +><H2 +>SEE ALSO</H2 +><P +> <SPAN +CLASS="CITEREFENTRY" +><SPAN +CLASS="REFENTRYTITLE" +>named</SPAN +>(8)</SPAN +>, + <I +CLASS="CITETITLE" +>RFC 1035</I +>, + <I +CLASS="CITETITLE" +>BIND 9 Administrator Reference Manual</I +>. + </P +></DIV +><DIV +CLASS="REFSECT1" +><A +NAME="AEN67" +></A +><H2 +>AUTHOR</H2 +><P +> Internet Software Consortium + </P +></DIV +></BODY +></HTML +>
\ No newline at end of file |