Commit 2d7f89b9 authored by Mark Andrews's avatar Mark Andrews
Browse files

4849. [bug] Duplicate zones could appear in the .nzf file if

                        addzone failed. [RT #46435]
parent ec91dfaf
4849. [bug] Duplicate zones could appear in the .nzf file if
addzone failed. [RT #46435]
4848. [func] Zone types "primary" and "secondary" can now be used
as synonyms for "master" and "slave" in named.conf.
[RT #46713]
......
......@@ -12609,6 +12609,7 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view,
dns_zone_t *zone = NULL;
#ifndef HAVE_LMDB
FILE *fp = NULL;
isc_boolean_t cleanup_config = ISC_FALSE;
#else /* HAVE_LMDB */
MDB_txn *txn = NULL;
MDB_dbi dbi;
......@@ -12701,14 +12702,15 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view,
* we've created. If there was a previous one, merge the new
* zone into it.
*/
if (cfg->nzf_config == NULL)
if (cfg->nzf_config == NULL) {
cfg_obj_attach(zoneconf, &cfg->nzf_config);
else {
} else {
cfg_obj_t *z;
DE_CONST(zoneobj, z);
CHECK(cfg_parser_mapadd(cfg->add_parser,
cfg->nzf_config, z, "zone"));
}
cleanup_config = ISC_TRUE;
#endif /* HAVE_LMDB */
/*
......@@ -12754,6 +12756,12 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view,
#ifndef HAVE_LMDB
if (fp != NULL)
(void)isc_stdio_close(fp);
if (result != ISC_R_SUCCESS && cleanup_config) {
tresult = delete_zoneconf(view, cfg->add_parser,
cfg->nzf_config, name,
NULL);
RUNTIME_CHECK(tresult == ISC_R_SUCCESS);
}
#else /* HAVE_LMDB */
if (txn != NULL)
(void) nzd_close(&txn, ISC_FALSE);
......
@ SOA ns3 hostmaster 0 0 0 0 0
@ NS ns3
ns3 A 10.53.0.3
......@@ -672,5 +672,19 @@ n=`expr $n + 1`
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
if ! $FEATURETEST --with-lmdb
then
echo "I:check that addzone is fully reversed on failure (--with-lmdb=no) ($n)"
ret=0
$RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 addzone "test1.baz" '{ type master; file "e.db"; };' > /dev/null 2>&1 || ret=1
$RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 addzone "test2.baz" '{ type master; file "dne.db"; };' > /dev/null 2>&1 && ret=1
$RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 addzone "test3.baz" '{ type master; file "e.db"; };' > /dev/null 2>&1 || ret=1
$RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 delzone "test3.baz" > /dev/null 2>&1 || ret=1
grep test2.baz ns3/_default.nzf > /dev/null && ret=1
n=`expr $n + 1`
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
fi
echo "I:exit status: $status"
[ $status -eq 0 ] || exit 1
......@@ -45,6 +45,7 @@ usage() {
fprintf(stderr, " --rpz-nsdname\n");
fprintf(stderr, " --rpz-nsip\n");
fprintf(stderr, " --with-idn\n");
fprintf(stderr, " --with-lmdb\n");
}
int
......@@ -156,6 +157,14 @@ main(int argc, char **argv) {
#endif
}
if (strcmp(argv[1], "--with-lmdb") == 0) {
#ifdef HAVE_LMDB
return (0);
#else
return (1);
#endif
}
if (strcmp(argv[1], "--ipv6only=no") == 0) {
#ifdef WIN32
return (0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment