mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
Merge branch '1101-matthijs-checkconf-i' into 'master'
named-checkconf -i: ignore deprecate warnings Closes #1101 See merge request isc-projects/bind9!2079
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,3 +1,6 @@
|
||||
5259. [func] New option '-i' for 'named-checkconf' to ignore
|
||||
warnings about deprecated options. [GL #1101]
|
||||
|
||||
5258. [func] Added support for the GeoIP2 API from MaxMind. This
|
||||
will be compiled in by default if the "libmaxminddb"
|
||||
library is found at compile time, but can be
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <isccfg/namedconf.h>
|
||||
#include <isccfg/grammar.h>
|
||||
|
||||
#include <bind9/check.h>
|
||||
|
||||
@@ -61,7 +62,7 @@ usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
|
||||
static void
|
||||
usage(void) {
|
||||
fprintf(stderr, "usage: %s [-chjlvz] [-p [-x]] [-t directory] "
|
||||
fprintf(stderr, "usage: %s [-chijlvz] [-p [-x]] [-t directory] "
|
||||
"[named.conf]\n", program);
|
||||
exit(1);
|
||||
}
|
||||
@@ -555,6 +556,7 @@ main(int argc, char **argv) {
|
||||
bool load_zones = false;
|
||||
bool list_zones = false;
|
||||
bool print = false;
|
||||
bool nodeprecate = false;
|
||||
unsigned int flags = 0;
|
||||
|
||||
isc_commandline_errprint = false;
|
||||
@@ -562,7 +564,7 @@ main(int argc, char **argv) {
|
||||
/*
|
||||
* Process memory debugging argument first.
|
||||
*/
|
||||
#define CMDLINE_FLAGS "cdhjlm:t:pvxz"
|
||||
#define CMDLINE_FLAGS "cdhijlm:t:pvxz"
|
||||
while ((c = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
||||
switch (c) {
|
||||
case 'm':
|
||||
@@ -595,6 +597,10 @@ main(int argc, char **argv) {
|
||||
debug++;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
nodeprecate = true;
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
nomerge = false;
|
||||
break;
|
||||
@@ -675,11 +681,16 @@ main(int argc, char **argv) {
|
||||
|
||||
RUNTIME_CHECK(cfg_parser_create(mctx, logc, &parser) == ISC_R_SUCCESS);
|
||||
|
||||
if (nodeprecate) {
|
||||
cfg_parser_setflags(parser, CFG_PCTX_NODEPRECATED, true);
|
||||
}
|
||||
cfg_parser_setcallback(parser, directory_callback, NULL);
|
||||
|
||||
if (cfg_parse_file(parser, conffile, &cfg_type_namedconf, &config) !=
|
||||
ISC_R_SUCCESS)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
|
||||
result = bind9_check_namedconf(config, loadplugins, logc, mctx);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
|
@@ -126,6 +126,15 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>-i</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Ignore warnings on deprecated options.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>-p</term>
|
||||
<listitem>
|
||||
|
36
bin/tests/system/checkconf/deprecated.conf
Normal file
36
bin/tests/system/checkconf/deprecated.conf
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
options {
|
||||
dnssec-validation yes;
|
||||
};
|
||||
|
||||
trusted-keys {
|
||||
fake.trusted. 257 3 8
|
||||
"AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjF
|
||||
FVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoX
|
||||
bfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaD
|
||||
X6RS6CXpoY68LsvPVjR0ZSwzz1apAzvN9dlzEheX7ICJBBtuA6G3LQpz
|
||||
W5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relS
|
||||
Qageu+ipAdTTJ25AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulq
|
||||
QxA+Uk1ihz0=";
|
||||
};
|
||||
|
||||
managed-keys {
|
||||
fake.managed. initial-key 257 3 8
|
||||
"AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3
|
||||
+/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kv
|
||||
ArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF
|
||||
0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+e
|
||||
oZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfd
|
||||
RUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwN
|
||||
R1AkUTV74bU=";
|
||||
};
|
@@ -126,6 +126,20 @@ grep '.*' < checkconf.out$n.3 > /dev/null && ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "checking named-checkconf deprecate warnings ($n)"
|
||||
ret=0
|
||||
$CHECKCONF deprecated.conf > checkconf.out$n.1 2>&1
|
||||
grep "option 'managed-keys' is deprecated" < checkconf.out$n.1 > /dev/null || ret=1
|
||||
grep "option 'trusted-keys' is deprecated" < checkconf.out$n.1 > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
# set -i to ignore deprecate warnings
|
||||
$CHECKCONF -i deprecated.conf > checkconf.out$n.2 2>&1
|
||||
grep '.*' < checkconf.out$n.2 > /dev/null && ret=1
|
||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
echo_i "range checking fields that do not allow zero ($n)"
|
||||
ret=0
|
||||
|
@@ -95,6 +95,17 @@ cfg_parser_create(isc_mem_t *mctx, isc_log_t *lctx, cfg_parser_t **ret);
|
||||
* be reused for parsing multiple files or buffers.
|
||||
*/
|
||||
|
||||
void
|
||||
cfg_parser_setflags(cfg_parser_t *pctx, unsigned int flags, bool turn_on);
|
||||
/*%<
|
||||
* Set parser context flags. The flags are not checked for sensibility.
|
||||
* If 'turn_on' is 'true' the flags will be set, otherwise the flags will
|
||||
* be cleared.
|
||||
*
|
||||
* Requires:
|
||||
*\li "pctx" is not NULL.
|
||||
*/
|
||||
|
||||
void
|
||||
cfg_parser_setcallback(cfg_parser_t *pctx,
|
||||
cfg_parsecallback_t callback,
|
||||
|
@@ -507,6 +507,18 @@ cfg_parser_create(isc_mem_t *mctx, isc_log_t *lctx, cfg_parser_t **ret) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
void
|
||||
cfg_parser_setflags(cfg_parser_t *pctx, unsigned int flags, bool turn_on)
|
||||
{
|
||||
REQUIRE(pctx != NULL);
|
||||
|
||||
if (turn_on) {
|
||||
pctx->flags |= flags;
|
||||
} else {
|
||||
pctx->flags &= ~flags;
|
||||
}
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
parser_openfile(cfg_parser_t *pctx, const char *filename) {
|
||||
isc_result_t result;
|
||||
|
@@ -97,6 +97,7 @@ cfg_parser_error
|
||||
cfg_parser_mapadd
|
||||
cfg_parser_reset
|
||||
cfg_parser_setcallback
|
||||
cfg_parser_setflags
|
||||
cfg_parser_warning
|
||||
cfg_peektoken
|
||||
cfg_pluginlist_foreach
|
||||
|
Reference in New Issue
Block a user