static isc_result_t
load_configuration(named_server_t *server, bool first_time) {
isc_result_t result;
- cfg_obj_t *config = NULL, *bindkeys = NULL, *effective = NULL;
+ cfg_obj_t *config = NULL, *effective = NULL;
+ cfg_obj_t *bindkeys = NULL, *builtin = NULL;
ns_dzarg_t dzarg = {
.magic = DZARG_MAGIC,
.result = ISC_R_SUCCESS,
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_DEBUG(1), "load_configuration");
+ CHECK(named_config_parsedefaults(&builtin));
CHECK(named_config_parsefile(&config));
if (named_g_bindkeysfile != NULL) {
}
/* Merge and apply */
- effective = cfg_effective_config(config, named_g_defaultconfig);
+ effective = cfg_effective_config(config, builtin);
/*
* Save the user configuration for later reference.
if (config != NULL) {
cfg_obj_detach(&config);
}
+ if (builtin != NULL) {
+ cfg_obj_detach(&builtin);
+ }
return result;
}
isc_timer_create(isc_loop_main(), pps_timer_tick, server,
&server->pps_timer);
- CHECKFATAL(named_config_parsedefaults(&named_g_defaultconfig),
- "unable to parse defaults config");
-
- CHECKFATAL(cfg_map_get(named_g_defaultconfig, "options",
- &named_g_defaultoptions),
- "missing 'options' in default config");
-
CHECKFATAL(load_configuration(server, true), "loading configuration");
CHECKFATAL(load_zones(server, false), "loading zones");
cfg_aclconfctx_detach(&server->aclctx);
}
- cfg_obj_detach(&named_g_defaultconfig);
-
(void)named_server_saventa(server);
ISC_LIST_FOREACH(server->kasplist, kasp, link) {
isc_buffer_t **text) {
isc_result_t result, tresult;
const char *arg = NULL;
- const cfg_obj_t *config = NULL;
+ cfg_obj_t *config = NULL;
ns_dzarg_t dzarg = {
.magic = DZARG_MAGIC,
.result = ISC_R_SUCCESS,
result = ISC_R_SUCCESS;
goto cleanup;
} else if (strcasecmp(arg, "-builtin") == 0) {
- config = named_g_defaultconfig;
+ named_config_parsedefaults(&config);
} else if (strcasecmp(arg, "-effective") == 0) {
- config = server->effectiveconfig;
+ cfg_obj_attach(server->effectiveconfig, &config);
} else {
CHECK(DNS_R_SYNTAX);
}
(void)putnull(text);
}
+ if (config != NULL) {
+ cfg_obj_detach(&config);
+ }
+
return result;
}