sizeof(common_named_defaultconf) - 1);
isc_buffer_add(&b, sizeof(common_named_defaultconf) - 1);
- return cfg_parse_buffer(
- isc_g_mctx, &b, __FILE__, 0, &cfg_type_namedconf,
- CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE |
- CFG_PCTX_NOEXPERIMENTAL | CFG_PCTX_BUILTIN,
- defaultconfig);
+ return cfg_parse_buffer(&b, __FILE__, 0, &cfg_type_namedconf,
+ CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE |
+ CFG_PCTX_NOEXPERIMENTAL |
+ CFG_PCTX_BUILTIN,
+ defaultconfig);
}
static void
}
CHECK(setup_logging(stdout));
- CHECK(cfg_parse_file(isc_g_mctx, conffile, &cfg_type_namedconf,
- parserflags, &config));
+ CHECK(cfg_parse_file(conffile, &cfg_type_namedconf, parserflags,
+ &config));
CHECK(isccfg_check_namedconf(config, checkflags, isc_g_mctx));
if (load_zones || list_zones) {
CHECK(load_zones_fromconfig(config, list_zones));
fatal("Unable to read key file '%s'", anchorfile);
}
- result = cfg_parse_file(isc_g_mctx, anchorfile,
- &cfg_type_bindkeys, 0, &bindkeys);
+ result = cfg_parse_file(anchorfile, &cfg_type_bindkeys, 0,
+ &bindkeys);
if (result != ISC_R_SUCCESS) {
fatal("Unable to load keys from '%s'", anchorfile);
}
isc_buffer_init(&b, anchortext, sizeof(anchortext) - 1);
isc_buffer_add(&b, sizeof(anchortext) - 1);
- result = cfg_parse_buffer(isc_g_mctx, &b, NULL, 0, &delv_type,
- 0, &bindkeys);
+ result = cfg_parse_buffer(&b, NULL, 0, &delv_type, 0,
+ &bindkeys);
if (result != ISC_R_SUCCESS) {
fatal("Unable to parse built-in keys");
}
return ISC_R_FILENOTFOUND;
}
- CHECK(cfg_parse_file(isc_g_mctx, keyfile, &cfg_type_sessionkey, 0,
- &file));
+ CHECK(cfg_parse_file(keyfile, &cfg_type_sessionkey, 0, &file));
CHECK(cfg_map_get(file, "key", &keyobj));
cfg_obj_t *config = NULL;
dns_kasp_t *kasp = NULL;
- if (cfg_parse_file(isc_g_mctx, ctx.configfile,
- &cfg_type_namedconf, 0,
- &config) != ISC_R_SUCCESS)
+ if (cfg_parse_file(ctx.configfile, &cfg_type_namedconf,
+ 0, &config) != ISC_R_SUCCESS)
{
fatal("unable to load dnssec-policy '%s' from "
"'%s'",
getkasp(ksr_ctx_t *ksr, dns_kasp_t **kasp) {
cfg_obj_t *config = NULL;
- if (cfg_parse_file(isc_g_mctx, ksr->configfile, &cfg_type_namedconf, 0,
- &config) != ISC_R_SUCCESS)
+ if (cfg_parse_file(ksr->configfile, &cfg_type_namedconf, 0, &config) !=
+ ISC_R_SUCCESS)
{
fatal("unable to load dnssec-policy '%s' from '%s'",
ksr->policy, ksr->configfile);
isc_buffer_constinit(&b, common_named_defaultconf,
sizeof(common_named_defaultconf) - 1);
isc_buffer_add(&b, sizeof(common_named_defaultconf) - 1);
- return cfg_parse_buffer(
- isc_g_mctx, &b, __FILE__, 0, &cfg_type_namedconf,
- CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE |
- CFG_PCTX_NOEXPERIMENTAL | CFG_PCTX_BUILTIN,
- conf);
+ return cfg_parse_buffer(&b, __FILE__, 0, &cfg_type_namedconf,
+ CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE |
+ CFG_PCTX_NOEXPERIMENTAL |
+ CFG_PCTX_BUILTIN,
+ conf);
}
isc_result_t
ISC_LOG_INFO, "parsing user configuration from '%s'",
named_g_conffile);
- CHECK(cfg_parse_file(isc_g_mctx, named_g_conffile, &cfg_type_namedconf,
- 0, conf));
+ CHECK(cfg_parse_file(named_g_conffile, &cfg_type_namedconf, 0, conf));
/*
* Check the validity of the configuration.
return ISC_R_FILENOTFOUND;
}
- CHECK(cfg_parse_file(mctx, named_g_keyfile, &cfg_type_rndckey, 0,
- &config));
+ CHECK(cfg_parse_file(named_g_keyfile, &cfg_type_rndckey, 0, &config));
CHECK(cfg_map_get(config, "key", &key));
keyid = isc_mem_get(mctx, sizeof(*keyid));
confbuf = NULL;
result = dns_catz_generate_zonecfg(cz->origin, cz->entry, &confbuf);
if (result == ISC_R_SUCCESS) {
- result = cfg_parse_buffer(isc_g_mctx, confbuf, "catz", 0,
+ result = cfg_parse_buffer(confbuf, "catz", 0,
&cfg_type_addzoneconf, 0, &zoneconf);
isc_buffer_free(&confbuf);
}
result = dns_catz_generate_zonecfg(data->catz, entry, &confbuf);
if (result == ISC_R_SUCCESS) {
- result = cfg_parse_buffer(isc_g_mctx, confbuf, "catz", 0,
+ result = cfg_parse_buffer(confbuf, "catz", 0,
&cfg_type_addzoneconf, 0, &zoneconf);
isc_buffer_free(&confbuf);
}
snprintf(bufname, sizeof(bufname), "%.*s", (int)zone_name_len,
zone_name);
- result = cfg_parse_buffer(isc_g_mctx, text, bufname, 0,
- &cfg_type_addzoneconf, 0, &zoneconf);
+ result = cfg_parse_buffer(text, bufname, 0, &cfg_type_addzoneconf, 0,
+ &zoneconf);
if (result != ISC_R_SUCCESS) {
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_ERROR,
"keys instead",
named_g_bindkeysfile);
} else {
- result = cfg_parse_file(
- isc_g_mctx, named_g_bindkeysfile,
- &cfg_type_bindkeys, 0, &bindkeys);
+ result = cfg_parse_file(named_g_bindkeysfile,
+ &cfg_type_bindkeys, 0,
+ &bindkeys);
if (result != ISC_R_SUCCESS) {
isc_log_write(NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER,
/*
* Parse the configuration in the NZF file.
*/
- result = cfg_parse_file(view->mctx, view->newzone.file,
- &cfg_type_addzoneconf, 0,
+ result = cfg_parse_file(view->newzone.file, &cfg_type_addzoneconf, 0,
&view->newzone.nzconfig);
if (result != ISC_R_SUCCESS) {
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
* config type, giving us a guarantee that valid configuration
* will be written to DB.
*/
- result = cfg_parse_file(isc_g_mctx, view->newzone.file,
- &cfg_type_addzoneconf, 0, &nzf_config);
+ result = cfg_parse_file(view->newzone.file, &cfg_type_addzoneconf, 0,
+ &nzf_config);
if (result != ISC_R_SUCCESS) {
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
ISC_LOG_ERROR, "Error parsing NZF file '%s': %s",
*/
isc_buffer_forward(&argbuf, 3);
- CHECK(cfg_parse_buffer(server->mctx, &argbuf, bn, 0,
- &cfg_type_addzoneconf, 0, &zoneconf));
+ CHECK(cfg_parse_buffer(&argbuf, bn, 0, &cfg_type_addzoneconf, 0,
+ &zoneconf));
CHECK(cfg_map_get(zoneconf, "zone", &zlist));
if (!cfg_obj_islist(zlist)) {
return ISC_R_FILENOTFOUND;
}
- CHECK(cfg_parse_file(mctx, keyfile, &cfg_type_sessionkey, 0,
- &sessionkey));
+ CHECK(cfg_parse_file(keyfile, &cfg_type_sessionkey, 0, &sessionkey));
CHECK(cfg_map_get(sessionkey, "key", &key));
isc_buffer_constinit(&b, parameters, strlen(parameters));
isc_buffer_add(&b, strlen(parameters));
- CHECK(cfg_parse_buffer(mctx, &b, cfg_file, cfg_line,
- &cfg_type_parameters, 0, ¶m_obj));
+ CHECK(cfg_parse_buffer(&b, cfg_file, cfg_line, &cfg_type_parameters, 0,
+ ¶m_obj));
CHECK(parse_filter_a_on(param_obj, "filter-a-on-v6", &inst->v6_a));
CHECK(parse_filter_a_on(param_obj, "filter-a-on-v4", &inst->v4_a));
isc_buffer_constinit(&b, parameters, strlen(parameters));
isc_buffer_add(&b, strlen(parameters));
- CHECK(cfg_parse_buffer(mctx, &b, cfg_file, cfg_line,
- &cfg_type_parameters, 0, ¶m_obj));
+ CHECK(cfg_parse_buffer(&b, cfg_file, cfg_line, &cfg_type_parameters, 0,
+ ¶m_obj));
CHECK(check_syntax(param_obj, cfg, mctx, aclctx));
isc_buffer_constinit(&b, parameters, strlen(parameters));
isc_buffer_add(&b, strlen(parameters));
- CHECK(cfg_parse_buffer(mctx, &b, cfg_file, cfg_line,
- &cfg_type_parameters, 0, ¶m_obj));
+ CHECK(cfg_parse_buffer(&b, cfg_file, cfg_line, &cfg_type_parameters, 0,
+ ¶m_obj));
CHECK(parse_filter_aaaa_on(param_obj, "filter-aaaa-on-v4",
&inst->v4_aaaa));
isc_buffer_constinit(&b, parameters, strlen(parameters));
isc_buffer_add(&b, strlen(parameters));
- CHECK(cfg_parse_buffer(mctx, &b, cfg_file, cfg_line,
- &cfg_type_parameters, 0, ¶m_obj));
+ CHECK(cfg_parse_buffer(&b, cfg_file, cfg_line, &cfg_type_parameters, 0,
+ ¶m_obj));
CHECK(check_syntax(param_obj, cfg, mctx, aclctx));
unsigned long cfgline, cfg_aclconfctx_t *aclctx,
const dns_name_t *zname) {
isc_result_t result;
- isc_mem_t *mctx = inst->mctx;
cfg_obj_t *synthrecordcfg = NULL;
isc_buffer_t b;
isc_buffer_constinit(&b, parameters, strlen(parameters));
isc_buffer_add(&b, strlen(parameters));
- CHECK(cfg_parse_buffer(mctx, &b, cfgfile, cfgline,
- &synthrecord_cfgparams, 0, &synthrecordcfg));
+ CHECK(cfg_parse_buffer(&b, cfgfile, cfgline, &synthrecord_cfgparams, 0,
+ &synthrecordcfg));
synthrecord_setconfigmode(inst, zname);
CHECK(synthrecord_initorigin(inst, synthrecordcfg, zname));
}
static void
-parse_config(isc_mem_t *mctx, const char *keyname, cfg_obj_t **configp) {
+parse_config(const char *keyname, cfg_obj_t **configp) {
isc_result_t result;
const char *conffile = admin_conffile;
const cfg_obj_t *addresses = NULL;
/*
* The parser will output its own errors, so DO() is not used.
*/
- result = cfg_parse_file(mctx, conffile, conftype, 0, &config);
+ result = cfg_parse_file(conffile, conftype, 0, &config);
if (result != ISC_R_SUCCESS) {
fatal("could not load rndc configuration");
}
ISC_LOG_PRINTTAG | ISC_LOG_PRINTLEVEL, ISC_LOGCATEGORY_DEFAULT,
ISC_LOGMODULE_DEFAULT);
- parse_config(isc_g_mctx, keyname, &config);
+ parse_config(keyname, &config);
isc_buffer_allocate(isc_g_mctx, &databuf, 2048);
isc_buffer_constinit(&b, parameters, strlen(parameters));
isc_buffer_add(&b, strlen(parameters));
- CHECK(cfg_parse_buffer(mctx, &b, cfgfile, cfgline,
- &syncplugin__cfgparams, 0, &syncplugincfg));
+ CHECK(cfg_parse_buffer(&b, cfgfile, cfgline, &syncplugin__cfgparams, 0,
+ &syncplugincfg));
CHECK(syncplugin__parse_rcode(syncplugincfg, &inst->rcode));
if (type == NULL || filename == NULL) {
usage();
}
- result = cfg_parse_file(mctx, filename, type, 0, &cfg);
+ result = cfg_parse_file(filename, type, 0, &cfg);
fprintf(stderr, "read config: %s\n", isc_result_totext(result));
}
if (memstats) {
+ /*
+ * TODO: this is memstat of config that we are interested in
+ * here, right?
+ */
isc_mem_stats(mctx, stderr);
}
isc_mem_detach(&mctx);
***/
isc_result_t
-cfg_parse_file(isc_mem_t *mctx, const char *file, const cfg_type_t *type,
- unsigned int flags, cfg_obj_t **ret);
+cfg_parse_file(const char *file, const cfg_type_t *type, unsigned int flags,
+ cfg_obj_t **ret);
isc_result_t
-cfg_parse_buffer(isc_mem_t *mctx, isc_buffer_t *buffer, const char *file,
- unsigned int line, const cfg_type_t *type, unsigned int flags,
- cfg_obj_t **ret);
+cfg_parse_buffer(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'
* and make '*ret' point to its parse tree.
&cfg_rep_list, &cfg_type_qstring };
static void
-parser_create(isc_mem_t *mctx, cfg_parser_t **ret) {
+parser_create(cfg_parser_t **ret) {
cfg_parser_t *pctx;
isc_lexspecials_t specials;
- REQUIRE(mctx != NULL);
REQUIRE(ret != NULL && *ret == NULL);
- pctx = isc_mem_get(mctx, sizeof(*pctx));
+ pctx = isc_mem_get(isc_g_mctx, sizeof(*pctx));
pctx->mctx = NULL;
- isc_mem_attach(mctx, &pctx->mctx);
+ isc_mem_attach(isc_g_mctx, &pctx->mctx);
pctx->lexer = NULL;
pctx->seen_eof = false;
specials['"'] = 1;
specials['!'] = 1;
- isc_lex_create(pctx->mctx, 1024, &pctx->lexer);
+ isc_lex_create(isc_g_mctx, 1024, &pctx->lexer);
isc_lex_setspecials(pctx->lexer, specials);
isc_lex_setcomments(pctx->lexer, ISC_LEXCOMMENT_C |
ISC_LEXCOMMENT_CPLUSPLUS |
ISC_LEXCOMMENT_SHELL);
- create_list(pctx->mctx, cfg_parser_currentfile(pctx), pctx->line,
+ create_list(isc_g_mctx, cfg_parser_currentfile(pctx), pctx->line,
&cfg_type_filelist, &pctx->open_files);
create_list(pctx->mctx, cfg_parser_currentfile(pctx), pctx->line,
&cfg_type_filelist, &pctx->closed_files);
CFG_PCTX_NOEXPERIMENTAL | CFG_PCTX_BUILTIN)) == 0)
isc_result_t
-cfg_parse_file(isc_mem_t *mctx, const char *filename, const cfg_type_t *type,
- unsigned int flags, cfg_obj_t **ret) {
+cfg_parse_file(const char *filename, const cfg_type_t *type, unsigned int flags,
+ cfg_obj_t **ret) {
isc_result_t result;
cfg_listelt_t *elt;
cfg_parser_t *pctx = NULL;
- REQUIRE(mctx != NULL);
REQUIRE(filename != NULL);
REQUIRE(type != NULL);
REQUIRE(ret != NULL && *ret == NULL);
REQUIRE_PCTX_FLAGS(flags);
- parser_create(mctx, &pctx);
+ parser_create(&pctx);
pctx->flags = flags;
CHECK(parser_openfile(pctx, filename));
}
isc_result_t
-cfg_parse_buffer(isc_mem_t *mctx, isc_buffer_t *buffer, const char *file,
- unsigned int line, const cfg_type_t *type, unsigned int flags,
- cfg_obj_t **ret) {
+cfg_parse_buffer(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;
cfg_parser_t *pctx = NULL;
- REQUIRE(mctx != NULL);
REQUIRE(type != NULL);
REQUIRE(buffer != NULL);
REQUIRE(ret != NULL && *ret == NULL);
REQUIRE_PCTX_FLAGS(flags);
- parser_create(mctx, &pctx);
+ parser_create(&pctx);
CHECK(isc_lex_openbuffer(pctx->lexer, buffer));
pctx->buf_name = file;
isc_buffer_add(&buf1, strlen(conf) - 1);
/* Parse with default line numbering */
- result = cfg_parse_buffer(isc_g_mctx, &buf1, "text1", 0,
+ result = cfg_parse_buffer(&buf1, "text1", 0,
&cfg_type_namedconf, 0, &c1);
if (must_fail) {
assert_int_equal(result, DNS_R_BADTTL);
isc_buffer_constinit(&buffer, config, strlen(config));
isc_buffer_add(&buffer, strlen(config));
- result = cfg_parse_buffer(isc_g_mctx, &buffer, "text1", 0,
- &cfg_type_namedconf, 0, &output_conf);
+ result = cfg_parse_buffer(&buffer, "text1", 0, &cfg_type_namedconf, 0,
+ &output_conf);
assert_int_equal(result, ISC_R_SUCCESS);
assert_non_null(output_conf);
isc_buffer_constinit(&b, tests[i], strlen(tests[i]));
isc_buffer_add(&b, strlen(tests[i]));
- result = cfg_parse_buffer(isc_g_mctx, &b, "text1", 0,
- &cfg_type_namedconf, 0, &conf);
+ result = cfg_parse_buffer(&b, "text1", 0, &cfg_type_namedconf,
+ 0, &conf);
assert_int_equal(result, ISC_R_SUCCESS);
/*
/* Parse with default line numbering. */
isc_buffer_init(&buf, &text[0], sizeof(text) - 1);
isc_buffer_add(&buf, sizeof(text) - 1);
- result = cfg_parse_buffer(isc_g_mctx, &buf, "text1", 0,
- &cfg_type_namedconf, 0, &c);
+ result = cfg_parse_buffer(&buf, "text1", 0, &cfg_type_namedconf, 0, &c);
assert_int_equal(result, ISC_R_FAILURE);
assert_null(c);
/* Parse with changed line number. */
isc_buffer_first(&buf);
- result = cfg_parse_buffer(isc_g_mctx, &buf, "text2", 100,
- &cfg_type_namedconf, 0, &c);
+ result = cfg_parse_buffer(&buf, "text2", 100, &cfg_type_namedconf, 0,
+ &c);
assert_int_equal(result, ISC_R_FAILURE);
assert_null(c);
/* Parse with changed line number and no name. */
isc_buffer_first(&buf);
- result = cfg_parse_buffer(isc_g_mctx, &buf, NULL, 100,
- &cfg_type_namedconf, 0, &c);
+ result = cfg_parse_buffer(&buf, NULL, 100, &cfg_type_namedconf, 0, &c);
assert_int_equal(result, ISC_R_FAILURE);
assert_null(c);
isc_buffer_init(&buf, conf, sizeof(conf));
isc_buffer_add(&buf, sizeof(conf) - 1);
- result = cfg_parse_buffer(isc_g_mctx, &buf, "", 0, &cfg_type_namedconf,
- 0, &orig);
+ result = cfg_parse_buffer(&buf, "", 0, &cfg_type_namedconf, 0, &orig);
assert_int_equal(result, ISC_R_SUCCESS);
isc_buffer_init(&dumpb1, dumpbdata1, sizeof(dumpbdata1));