mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 23:25:38 +00:00
Merge branch '322-add-support-for-marking-options-as-deprecated' into 'master'
Resolve "add support for marking options as deprecated." Closes #322 See merge request isc-projects/bind9!351
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,3 +1,6 @@
|
|||||||
|
4965. [func] Add support for marking options as deprecated.
|
||||||
|
[GL #322]
|
||||||
|
|
||||||
4964. [bug] Reduce the probabilty of double signature when deleting
|
4964. [bug] Reduce the probabilty of double signature when deleting
|
||||||
a DNSKEY by checking if the node is otherwise signed
|
a DNSKEY by checking if the node is otherwise signed
|
||||||
by the algorithm of the key to be deleted. [GL #240]
|
by the algorithm of the key to be deleted. [GL #240]
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include <pk11/site.h>
|
#include <pk11/site.h>
|
||||||
|
|
||||||
|
#include <isccfg/grammar.h>
|
||||||
#include <isccfg/namedconf.h>
|
#include <isccfg/namedconf.h>
|
||||||
|
|
||||||
#include <dns/fixedname.h>
|
#include <dns/fixedname.h>
|
||||||
@@ -308,8 +309,9 @@ named_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf) {
|
|||||||
|
|
||||||
isc_buffer_init(&b, defaultconf, sizeof(defaultconf) - 1);
|
isc_buffer_init(&b, defaultconf, sizeof(defaultconf) - 1);
|
||||||
isc_buffer_add(&b, sizeof(defaultconf) - 1);
|
isc_buffer_add(&b, sizeof(defaultconf) - 1);
|
||||||
return (cfg_parse_buffer3(parser, &b, __FILE__, 0,
|
return (cfg_parse_buffer4(parser, &b, __FILE__, 0,
|
||||||
&cfg_type_namedconf, conf));
|
&cfg_type_namedconf,
|
||||||
|
CFG_PCTX_NODEPRECATED, conf));
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
|
@@ -121,6 +121,11 @@ isc_result_t
|
|||||||
cfg_parse_buffer3(cfg_parser_t *pctx, isc_buffer_t *buffer,
|
cfg_parse_buffer3(cfg_parser_t *pctx, isc_buffer_t *buffer,
|
||||||
const char *file, unsigned int line,
|
const char *file, unsigned int line,
|
||||||
const cfg_type_t *type, cfg_obj_t **ret);
|
const cfg_type_t *type, cfg_obj_t **ret);
|
||||||
|
isc_result_t
|
||||||
|
cfg_parse_buffer4(cfg_parser_t *pctx, isc_buffer_t *buffer,
|
||||||
|
const char *file, unsigned int line,
|
||||||
|
const cfg_type_t *type, unsigned int flags,
|
||||||
|
cfg_obj_t **ret);
|
||||||
/*%<
|
/*%<
|
||||||
* Read a configuration containing data of type 'type'
|
* Read a configuration containing data of type 'type'
|
||||||
* and make '*ret' point to its parse tree.
|
* and make '*ret' point to its parse tree.
|
||||||
@@ -143,6 +148,7 @@ cfg_parse_buffer3(cfg_parser_t *pctx, isc_buffer_t *buffer,
|
|||||||
*\li "mem" is valid.
|
*\li "mem" is valid.
|
||||||
*\li "type" is valid.
|
*\li "type" is valid.
|
||||||
*\li "cfg" is non-NULL and "*cfg" is NULL.
|
*\li "cfg" is non-NULL and "*cfg" is NULL.
|
||||||
|
*\li "flags" be one or more of CFG_PCTX_NODEPRECATED or zero.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* \li #ISC_R_SUCCESS - success
|
* \li #ISC_R_SUCCESS - success
|
||||||
|
@@ -52,6 +52,8 @@
|
|||||||
/*% A configuration option that is ineffective due to
|
/*% A configuration option that is ineffective due to
|
||||||
* compile time options, but is harmless. */
|
* compile time options, but is harmless. */
|
||||||
#define CFG_CLAUSEFLAG_NOOP 0x00000200
|
#define CFG_CLAUSEFLAG_NOOP 0x00000200
|
||||||
|
/*% Clause is obsolete in a future release */
|
||||||
|
#define CFG_CLAUSEFLAG_DEPRECATED 0x00000400
|
||||||
|
|
||||||
/*%
|
/*%
|
||||||
* Zone types for which a clause is valid:
|
* Zone types for which a clause is valid:
|
||||||
@@ -252,6 +254,7 @@ struct cfg_parser {
|
|||||||
|
|
||||||
/* Parser context flags */
|
/* Parser context flags */
|
||||||
#define CFG_PCTX_SKIP 0x1
|
#define CFG_PCTX_SKIP 0x1
|
||||||
|
#define CFG_PCTX_NODEPRECATED 0x2
|
||||||
|
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/*%
|
/*%
|
||||||
|
@@ -615,7 +615,7 @@ isc_result_t
|
|||||||
cfg_parse_buffer(cfg_parser_t *pctx, isc_buffer_t *buffer,
|
cfg_parse_buffer(cfg_parser_t *pctx, isc_buffer_t *buffer,
|
||||||
const cfg_type_t *type, cfg_obj_t **ret)
|
const cfg_type_t *type, cfg_obj_t **ret)
|
||||||
{
|
{
|
||||||
return (cfg_parse_buffer3(pctx, buffer, NULL, 0, type, ret));
|
return (cfg_parse_buffer4(pctx, buffer, NULL, 0, type, 0, ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
@@ -623,13 +623,22 @@ cfg_parse_buffer2(cfg_parser_t *pctx, isc_buffer_t *buffer,
|
|||||||
const char *file, const cfg_type_t *type,
|
const char *file, const cfg_type_t *type,
|
||||||
cfg_obj_t **ret)
|
cfg_obj_t **ret)
|
||||||
{
|
{
|
||||||
return (cfg_parse_buffer3(pctx, buffer, file, 0, type, ret));
|
return (cfg_parse_buffer4(pctx, buffer, file, 0, type, 0, ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
cfg_parse_buffer3(cfg_parser_t *pctx, isc_buffer_t *buffer,
|
cfg_parse_buffer3(cfg_parser_t *pctx, isc_buffer_t *buffer,
|
||||||
const char *file, unsigned int line,
|
const char *file, unsigned int line,
|
||||||
const cfg_type_t *type, cfg_obj_t **ret)
|
const cfg_type_t *type, cfg_obj_t **ret)
|
||||||
|
{
|
||||||
|
return (cfg_parse_buffer4(pctx, buffer, file, line, type, 0, ret));
|
||||||
|
}
|
||||||
|
|
||||||
|
isc_result_t
|
||||||
|
cfg_parse_buffer4(cfg_parser_t *pctx, isc_buffer_t *buffer,
|
||||||
|
const char *file, unsigned int line,
|
||||||
|
const cfg_type_t *type, unsigned int flags,
|
||||||
|
cfg_obj_t **ret)
|
||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
@@ -637,10 +646,12 @@ cfg_parse_buffer3(cfg_parser_t *pctx, isc_buffer_t *buffer,
|
|||||||
REQUIRE(type != NULL);
|
REQUIRE(type != NULL);
|
||||||
REQUIRE(buffer != NULL);
|
REQUIRE(buffer != NULL);
|
||||||
REQUIRE(ret != NULL && *ret == NULL);
|
REQUIRE(ret != NULL && *ret == NULL);
|
||||||
|
REQUIRE((flags & ~(CFG_PCTX_NODEPRECATED)) == 0);
|
||||||
|
|
||||||
CHECK(isc_lex_openbuffer(pctx->lexer, buffer));
|
CHECK(isc_lex_openbuffer(pctx->lexer, buffer));
|
||||||
|
|
||||||
pctx->buf_name = file;
|
pctx->buf_name = file;
|
||||||
|
pctx->flags = flags;
|
||||||
|
|
||||||
if (line != 0U)
|
if (line != 0U)
|
||||||
CHECK(isc_lex_setsourceline(pctx->lexer, line));
|
CHECK(isc_lex_setsourceline(pctx->lexer, line));
|
||||||
@@ -1697,12 +1708,14 @@ cfg_parse_mapbody(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret)
|
|||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
if (clause == NULL || clause->name == NULL) {
|
if (clause == NULL || clause->name == NULL) {
|
||||||
cfg_parser_error(pctx, CFG_LOG_NOPREP, "unknown option");
|
cfg_parser_error(pctx, CFG_LOG_NOPREP,
|
||||||
|
"unknown option");
|
||||||
/*
|
/*
|
||||||
* Try to recover by parsing this option as an unknown
|
* Try to recover by parsing this option as an unknown
|
||||||
* option and discarding it.
|
* option and discarding it.
|
||||||
*/
|
*/
|
||||||
CHECK(cfg_parse_obj(pctx, &cfg_type_unsupported, &eltobj));
|
CHECK(cfg_parse_obj(pctx, &cfg_type_unsupported,
|
||||||
|
&eltobj));
|
||||||
cfg_obj_destroy(pctx, &eltobj);
|
cfg_obj_destroy(pctx, &eltobj);
|
||||||
CHECK(parse_semicolon(pctx));
|
CHECK(parse_semicolon(pctx));
|
||||||
continue;
|
continue;
|
||||||
@@ -1711,16 +1724,24 @@ cfg_parse_mapbody(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret)
|
|||||||
/* Clause is known. */
|
/* Clause is known. */
|
||||||
|
|
||||||
/* Issue warnings if appropriate */
|
/* Issue warnings if appropriate */
|
||||||
if ((clause->flags & CFG_CLAUSEFLAG_OBSOLETE) != 0)
|
if ((pctx->flags & CFG_PCTX_NODEPRECATED) == 0 &&
|
||||||
|
(clause->flags & CFG_CLAUSEFLAG_DEPRECATED) != 0)
|
||||||
|
{
|
||||||
|
cfg_parser_warning(pctx, 0, "option '%s' is deprecated",
|
||||||
|
clause->name);
|
||||||
|
}
|
||||||
|
if ((clause->flags & CFG_CLAUSEFLAG_OBSOLETE) != 0) {
|
||||||
cfg_parser_warning(pctx, 0, "option '%s' is obsolete",
|
cfg_parser_warning(pctx, 0, "option '%s' is obsolete",
|
||||||
clause->name);
|
clause->name);
|
||||||
if ((clause->flags & CFG_CLAUSEFLAG_NOTIMP) != 0)
|
}
|
||||||
|
if ((clause->flags & CFG_CLAUSEFLAG_NOTIMP) != 0) {
|
||||||
cfg_parser_warning(pctx, 0, "option '%s' is "
|
cfg_parser_warning(pctx, 0, "option '%s' is "
|
||||||
"not implemented", clause->name);
|
"not implemented", clause->name);
|
||||||
if ((clause->flags & CFG_CLAUSEFLAG_NYI) != 0)
|
}
|
||||||
|
if ((clause->flags & CFG_CLAUSEFLAG_NYI) != 0) {
|
||||||
cfg_parser_warning(pctx, 0, "option '%s' is "
|
cfg_parser_warning(pctx, 0, "option '%s' is "
|
||||||
"not implemented", clause->name);
|
"not implemented", clause->name);
|
||||||
|
}
|
||||||
if ((clause->flags & CFG_CLAUSEFLAG_NOOP) != 0) {
|
if ((clause->flags & CFG_CLAUSEFLAG_NOOP) != 0) {
|
||||||
cfg_parser_warning(pctx, 0, "option '%s' was not "
|
cfg_parser_warning(pctx, 0, "option '%s' was not "
|
||||||
"enabled at compile time "
|
"enabled at compile time "
|
||||||
|
Reference in New Issue
Block a user