static isc_result_t
delete_zoneconf(dns_view_t *view, cfg_parser_t *pctx, const cfg_obj_t *config,
- const dns_name_t *zname, nzfwriter_t nzfwriter) {
+ const dns_name_t *zname, nzfwriter_t nzfwriter, bool locked) {
isc_result_t result = ISC_R_NOTFOUND;
const cfg_listelt_t *elt = NULL;
const cfg_obj_t *zl = NULL;
REQUIRE(config != NULL);
REQUIRE(zname != NULL);
- LOCK(&view->new_zone_lock);
+ if (!locked) {
+ LOCK(&view->new_zone_lock);
+ }
cfg_map_get(config, "zone", &zl);
}
cleanup:
- UNLOCK(&view->new_zone_lock);
+ if (!locked) {
+ UNLOCK(&view->new_zone_lock);
+ }
return result;
}
bool redirect, isc_buffer_t **text) {
isc_result_t result, tresult;
dns_zone_t *zone = NULL;
+ bool locked = false;
#ifndef HAVE_LMDB
FILE *fp = NULL;
bool cleanup_config = false;
#else /* HAVE_LMDB */
MDB_txn *txn = NULL;
MDB_dbi dbi;
- bool locked = false;
UNUSED(zoneconf);
#endif
}
if (result != ISC_R_SUCCESS && cleanup_config) {
tresult = delete_zoneconf(view, cfg->add_parser,
- cfg->nzf_config, name, NULL);
+ cfg->nzf_config, name, NULL, locked);
RUNTIME_CHECK(tresult == ISC_R_SUCCESS);
}
#else /* HAVE_LMDB */
isc_result_t result, tresult;
dns_zone_t *zone = NULL;
bool added;
+ bool locked = false;
#ifndef HAVE_LMDB
FILE *fp = NULL;
cfg_obj_t *z;
#else /* HAVE_LMDB */
MDB_txn *txn = NULL;
MDB_dbi dbi;
- bool locked = false;
#endif /* HAVE_LMDB */
/* Zone must already exist */
if (added) {
result = delete_zoneconf(view, cfg->add_parser, cfg->nzf_config,
dns_zone_getorigin(zone),
- nzf_writeconf);
+ nzf_writeconf, locked);
if (result != ISC_R_SUCCESS) {
TCHECK(putstr(text, "former zone configuration "
"not deleted: "));
if (cfg->vconfig == NULL) {
result = delete_zoneconf(
view, cfg->conf_parser, cfg->config,
- dns_zone_getorigin(zone), NULL);
+ dns_zone_getorigin(zone), NULL, locked);
} else {
const cfg_obj_t *voptions = cfg_tuple_get(cfg->vconfig,
"options");
result = delete_zoneconf(
view, cfg->conf_parser, voptions,
- dns_zone_getorigin(zone), NULL);
+ dns_zone_getorigin(zone), NULL, locked);
}
if (result != ISC_R_SUCCESS) {
#else /* ifdef HAVE_LMDB */
result = delete_zoneconf(view, cfg->add_parser, cfg->nzf_config,
dns_zone_getorigin(zone),
- nzf_writeconf);
+ nzf_writeconf, false);
if (result != ISC_R_SUCCESS) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
"options");
result = delete_zoneconf(
view, cfg->conf_parser, voptions,
- dns_zone_getorigin(zone), NULL);
+ dns_zone_getorigin(zone), NULL, false);
} else {
result = delete_zoneconf(
view, cfg->conf_parser, cfg->config,
- dns_zone_getorigin(zone), NULL);
+ dns_zone_getorigin(zone), NULL, false);
}
if (result != ISC_R_SUCCESS) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,