2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

2936. [func] Improved configuration syntax and multiple-view

support for addzone/delzone feature (see change
			#2930).  Removed "new-zone-file" option, replaced
			with "allow-new-zones (yes|no)".  The new-zone-file
			for each view is now created automatically, with
			a filename generated from a hash of the view name.
			It is no longer necessary to "include" the
			new-zone-file in named.conf; this happens
			automatically.  Zones that were not added via
			"rndc addzone" can no longer be removed with
			"rndc delzone". [RT #19447]
This commit is contained in:
Evan Hunt
2010-08-11 18:14:20 +00:00
parent 7d7cdecee6
commit cfd262045c
29 changed files with 894 additions and 365 deletions

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: parser.c,v 1.134 2010/06/23 23:46:58 tbox Exp $ */
/* $Id: parser.c,v 1.135 2010/08/11 18:14:20 each Exp $ */
/*! \file */
@@ -387,6 +387,12 @@ cfg_parser_create(isc_mem_t *mctx, isc_log_t *lctx, cfg_parser_t **ret) {
if (pctx == NULL)
return (ISC_R_NOMEMORY);
result = isc_refcount_init(&pctx->references, 1);
if (result != ISC_R_SUCCESS) {
isc_mem_put(mctx, pctx, sizeof(*pctx));
return (result);
}
pctx->mctx = mctx;
pctx->lctx = lctx;
pctx->lexer = NULL;
@@ -526,18 +532,31 @@ cfg_parse_buffer(cfg_parser_t *pctx, isc_buffer_t *buffer,
return (result);
}
void
cfg_parser_attach(cfg_parser_t *src, cfg_parser_t **dest) {
REQUIRE(src != NULL);
REQUIRE(dest != NULL && *dest == NULL);
isc_refcount_increment(&src->references, NULL);
*dest = src;
}
void
cfg_parser_destroy(cfg_parser_t **pctxp) {
cfg_parser_t *pctx = *pctxp;
isc_lex_destroy(&pctx->lexer);
/*
* Cleaning up open_files does not
* close the files; that was already done
* by closing the lexer.
*/
CLEANUP_OBJ(pctx->open_files);
CLEANUP_OBJ(pctx->closed_files);
isc_mem_put(pctx->mctx, pctx, sizeof(*pctx));
unsigned int refs;
isc_refcount_decrement(&pctx->references, &refs);
if (refs == 0) {
isc_lex_destroy(&pctx->lexer);
/*
* Cleaning up open_files does not
* close the files; that was already done
* by closing the lexer.
*/
CLEANUP_OBJ(pctx->open_files);
CLEANUP_OBJ(pctx->closed_files);
isc_mem_put(pctx->mctx, pctx, sizeof(*pctx));
}
*pctxp = NULL;
}
@@ -1133,7 +1152,7 @@ cfg_list_length(const cfg_obj_t *obj, isc_boolean_t recurse) {
return (count);
}
const cfg_obj_t *
cfg_obj_t *
cfg_listelt_value(const cfg_listelt_t *elt) {
REQUIRE(elt != NULL);
return (elt->obj);
@@ -2315,6 +2334,7 @@ cfg_obj_line(const cfg_obj_t *obj) {
isc_result_t
cfg_create_obj(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
isc_result_t result;
cfg_obj_t *obj;
obj = isc_mem_get(pctx->mctx, sizeof(cfg_obj_t));
@@ -2323,10 +2343,16 @@ cfg_create_obj(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
obj->type = type;
obj->file = current_file(pctx);
obj->line = pctx->line;
result = isc_refcount_init(&obj->references, 1);
if (result != ISC_R_SUCCESS) {
isc_mem_put(pctx->mctx, obj, sizeof(cfg_obj_t));
return (result);
}
*ret = obj;
return (ISC_R_SUCCESS);
}
static void
map_symtabitem_destroy(char *key, unsigned int type,
isc_symvalue_t symval, void *userarg)
@@ -2380,11 +2406,25 @@ cfg_obj_istype(const cfg_obj_t *obj, const cfg_type_t *type) {
void
cfg_obj_destroy(cfg_parser_t *pctx, cfg_obj_t **objp) {
cfg_obj_t *obj = *objp;
obj->type->rep->free(pctx, obj);
isc_mem_put(pctx->mctx, obj, sizeof(cfg_obj_t));
unsigned int refs;
isc_refcount_decrement(&obj->references, &refs);
if (refs == 0) {
obj->type->rep->free(pctx, obj);
isc_refcount_destroy(&obj->references);
isc_mem_put(pctx->mctx, obj, sizeof(cfg_obj_t));
}
*objp = NULL;
}
void
cfg_obj_attach(cfg_obj_t *src, cfg_obj_t **dest) {
REQUIRE(src != NULL);
REQUIRE(dest != NULL && *dest == NULL);
isc_refcount_increment(&src->references, NULL);
*dest = src;
}
static void
free_noop(cfg_parser_t *pctx, cfg_obj_t *obj) {
UNUSED(pctx);