diff --git a/CHANGES b/CHANGES index 83e62e7281..60864ba6bc 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2624. [func] 'named-checkconf -p' will print out the parsed + configuration. [RT #18871] + 2623. [bug] Named started seaches for DS non-optimally. [RT #19915] 2622. [bug] Printing of named.conf grammar was broken. [RT #19919] diff --git a/bin/check/named-checkconf.c b/bin/check/named-checkconf.c index 4ed050bc51..51c40704e9 100644 --- a/bin/check/named-checkconf.c +++ b/bin/check/named-checkconf.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: named-checkconf.c,v 1.48 2009/02/16 23:48:04 tbox Exp $ */ +/* $Id: named-checkconf.c,v 1.49 2009/07/13 06:57:21 marka Exp $ */ /*! \file */ @@ -387,6 +387,15 @@ load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx) { return (result); } +static void +output(void *closure, const char *text, int textlen) { + UNUSED(closure); + if (fwrite(text, 1, textlen, stdout) != (size_t)textlen) { + perror("fwrite"); + exit(1); + } +} + /*% The main processing routine */ int main(int argc, char **argv) { @@ -399,10 +408,11 @@ main(int argc, char **argv) { int exit_status = 0; isc_entropy_t *ectx = NULL; isc_boolean_t load_zones = ISC_FALSE; + isc_boolean_t print = ISC_FALSE; isc_commandline_errprint = ISC_FALSE; - while ((c = isc_commandline_parse(argc, argv, "dhjt:vz")) != EOF) { + while ((c = isc_commandline_parse(argc, argv, "dhjt:pvz")) != EOF) { switch (c) { case 'd': debug++; @@ -421,6 +431,10 @@ main(int argc, char **argv) { } break; + case 'p': + print = ISC_TRUE; + break; + case 'v': printf(VERSION "\n"); exit(0); @@ -481,6 +495,8 @@ main(int argc, char **argv) { exit_status = 1; } + if (print && exit_status == 0) + cfg_print(config, output, NULL); cfg_obj_destroy(parser, &config); cfg_parser_destroy(&parser); diff --git a/bin/check/named-checkconf.docbook b/bin/check/named-checkconf.docbook index 53592392da..ce072c8929 100644 --- a/bin/check/named-checkconf.docbook +++ b/bin/check/named-checkconf.docbook @@ -18,7 +18,7 @@ - PERFORMANCE OF THIS SOFTWARE. --> - + June 14, 2000 @@ -58,6 +58,7 @@ filename + @@ -87,8 +88,7 @@ -t directory - Chroot to directory so that - include + Chroot to directory so that include directives in the configuration file are processed as if run by a similarly chrooted named. @@ -105,6 +105,16 @@ + + -p + + + Print out the named.conf and included files + in canonical form if no errors were detected. + + + + -z