mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
Add flag to named-checkconf to ignore "not configured" errors
named-checkconf now takes "-n" to ignore "not configured" errors. This allows named-checkconf to check the syntax of configurations from other builds which have support for more options.
This commit is contained in:
parent
004a5329e2
commit
61faffd06f
@ -594,6 +594,7 @@ main(int argc, char **argv) {
|
|||||||
bool list_zones = false;
|
bool list_zones = false;
|
||||||
bool print = false;
|
bool print = false;
|
||||||
bool nodeprecate = false;
|
bool nodeprecate = false;
|
||||||
|
bool allconfigs = false;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
unsigned int checkflags = BIND_CHECK_PLUGINS | BIND_CHECK_ALGORITHMS;
|
unsigned int checkflags = BIND_CHECK_PLUGINS | BIND_CHECK_ALGORITHMS;
|
||||||
|
|
||||||
@ -602,7 +603,7 @@ main(int argc, char **argv) {
|
|||||||
/*
|
/*
|
||||||
* Process memory debugging argument first.
|
* Process memory debugging argument first.
|
||||||
*/
|
*/
|
||||||
#define CMDLINE_FLAGS "acdhijlm:t:pvxz"
|
#define CMDLINE_FLAGS "acdhijlm:nt:pvxz"
|
||||||
while ((c = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
while ((c = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'm':
|
case 'm':
|
||||||
@ -656,6 +657,10 @@ main(int argc, char **argv) {
|
|||||||
case 'm':
|
case 'm':
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'n':
|
||||||
|
allconfigs = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
result = isc_dir_chroot(isc_commandline_argument);
|
result = isc_dir_chroot(isc_commandline_argument);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
@ -729,6 +734,9 @@ main(int argc, char **argv) {
|
|||||||
if (nodeprecate) {
|
if (nodeprecate) {
|
||||||
cfg_parser_setflags(parser, CFG_PCTX_NODEPRECATED, true);
|
cfg_parser_setflags(parser, CFG_PCTX_NODEPRECATED, true);
|
||||||
}
|
}
|
||||||
|
if (allconfigs) {
|
||||||
|
cfg_parser_setflags(parser, CFG_PCTX_ALLCONFIGS, true);
|
||||||
|
}
|
||||||
cfg_parser_setcallback(parser, directory_callback, NULL);
|
cfg_parser_setcallback(parser, directory_callback, NULL);
|
||||||
|
|
||||||
CHECK(cfg_parse_file(parser, conffile, &cfg_type_namedconf, &config));
|
CHECK(cfg_parse_file(parser, conffile, &cfg_type_namedconf, &config));
|
||||||
|
@ -21,7 +21,7 @@ named-checkconf - named configuration file syntax checking tool
|
|||||||
Synopsis
|
Synopsis
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
|
|
||||||
:program:`named-checkconf` [**-achjlvz**] [**-p** [**-x** ]] [**-t** directory] {filename}
|
:program:`named-checkconf` [**-achjlnvz**] [**-p** [**-x** ]] [**-t** directory] {filename}
|
||||||
|
|
||||||
Description
|
Description
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
@ -71,6 +71,10 @@ Options
|
|||||||
|
|
||||||
This option ignores warnings on deprecated options.
|
This option ignores warnings on deprecated options.
|
||||||
|
|
||||||
|
.. option:: -n
|
||||||
|
|
||||||
|
Do not error on options that are disabled in this build.
|
||||||
|
|
||||||
.. option:: -p
|
.. option:: -p
|
||||||
|
|
||||||
This option prints out the :iscman:`named.conf` and included files in canonical form if
|
This option prints out the :iscman:`named.conf` and included files in canonical form if
|
||||||
|
@ -261,6 +261,7 @@ struct cfg_parser {
|
|||||||
#define CFG_PCTX_NODEPRECATED (1 << 1)
|
#define CFG_PCTX_NODEPRECATED (1 << 1)
|
||||||
#define CFG_PCTX_NOOBSOLETE (1 << 2)
|
#define CFG_PCTX_NOOBSOLETE (1 << 2)
|
||||||
#define CFG_PCTX_NOEXPERIMENTAL (1 << 3)
|
#define CFG_PCTX_NOEXPERIMENTAL (1 << 3)
|
||||||
|
#define CFG_PCTX_ALLCONFIGS (1 << 4)
|
||||||
|
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/*%
|
/*%
|
||||||
|
@ -2341,7 +2341,9 @@ cfg_parse_mapbody(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
|
|||||||
clause->name);
|
clause->name);
|
||||||
CHECK(ISC_R_FAILURE);
|
CHECK(ISC_R_FAILURE);
|
||||||
}
|
}
|
||||||
if ((clause->flags & CFG_CLAUSEFLAG_NOTCONFIGURED) != 0) {
|
if ((pctx->flags & CFG_PCTX_ALLCONFIGS) == 0 &&
|
||||||
|
(clause->flags & CFG_CLAUSEFLAG_NOTCONFIGURED) != 0)
|
||||||
|
{
|
||||||
cfg_parser_error(pctx, 0,
|
cfg_parser_error(pctx, 0,
|
||||||
"option '%s' was not "
|
"option '%s' was not "
|
||||||
"enabled at compile time",
|
"enabled at compile time",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user