dns_db_t *dbp = NULL;
isc_boolean_t added;
isc_result_t result;
+#ifdef HAVE_LMDB
+ MDB_txn *txn = NULL;
+ MDB_dbi dbi;
+#endif
REQUIRE(dz != NULL);
/* Remove the zone from configuration (and NZF file if applicable) */
added = dns_zone_getadded(zone);
-#ifndef HAVE_LMDB
if (added && cfg != NULL) {
+#ifdef HAVE_LMDB
+ /* Make sure we can open the NZD database */
+ result = nzd_open(view, 0, &txn, &dbi);
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
+ NS_LOGMODULE_SERVER,
+ ISC_LOG_ERROR,
+ "unable to open NZD database for '%s'",
+ view->new_zone_db);
+ } else {
+ result = nzd_save(&txn, dbi, zone, NULL);
+ }
+
+ if (result != ISC_R_SUCCESS) {
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
+ NS_LOGMODULE_SERVER,
+ ISC_LOG_ERROR, "unable to "
+ "delete zone configuration: %s",
+ isc_result_totext(result));
+ }
+#else
result = delete_zoneconf(view, cfg->add_parser,
cfg->nzf_config,
dns_zone_getorigin(zone),
if (result != ISC_R_SUCCESS) {
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER,
- ISC_LOG_WARNING, "unable to "
+ ISC_LOG_ERROR, "unable to "
"delete zone configuration: %s",
isc_result_totext(result));
}
- }
#endif /* HAVE_LMDB */
+ }
if (!added && cfg != NULL) {
if (cfg->vconfig != NULL) {
if (result != ISC_R_SUCCESS){
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER,
- ISC_LOG_WARNING, "unable to "
+ ISC_LOG_ERROR, "unable to "
"delete zone configuration: %s",
isc_result_totext(result));
}
}
}
+#ifdef HAVE_LMDB
+ if (txn != NULL)
+ (void) nzd_close(&txn, ISC_FALSE);
+#endif
if (raw != NULL)
dns_zone_detach(&raw);
dns_zone_detach(&zone);
ns_dzctx_t *dz = NULL;
isc_event_t *dzevent = NULL;
isc_task_t *task = NULL;
-#ifdef HAVE_LMDB
- MDB_txn *txn = NULL;
-#endif /* HAVE_LMDB */
/* Skip the command name. */
ptr = next_token(lex, text);
dns_zone_detach(&dz->zone);
isc_mem_put(ns_g_mctx, dz, sizeof(*dz));
}
-#ifdef HAVE_LMDB
- if (txn != NULL)
- (void) nzd_close(&txn, ISC_FALSE);
-#endif /* HAVE_LMDB */
return (result);
}
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
+if [ -n "$NZD" ]; then
+ echo "I:checking zone is present in NZD ($n)"
+ ret=0
+ $NZD2NZF ns2/_default.nzd | grep previous.example > /dev/null || ret=1
+ if [ $ret != 0 ]; then echo "I:failed"; fi
+ status=`expr $status + $ret`
+fi
+
echo "I:deleting previously added zone ($n)"
ret=0
$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 delzone previous.example 2>&1 | sed 's/^/I:ns2 /'
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
+if [ -n "$NZD" ]; then
+ echo "I:checking zone was deleted from NZD ($n)"
+ for i in 0 1 2 3 4 5 6 7 8 9; do
+ ret=0
+ $NZD2NZF ns2/_default.nzd | grep previous.example > /dev/null && ret=1
+ [ $ret = 0 ] && break
+ sleep 1
+ done
+ if [ $ret != 0 ]; then echo "I:failed"; fi
+ status=`expr $status + $ret`
+fi
+
if [ -z "$NZD" ]; then
echo "I:checking NZF file now has comment ($n)"
ret=0