2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Merge branch '2947-unexpected-deletion-of-configured-catalog-zone' into 'main'

Resolve "unexpected deletion of configured catalog zone"

Closes #2947

See merge request isc-projects/bind9!5491
This commit is contained in:
Mark Andrews
2021-10-15 05:24:00 +00:00
2 changed files with 58 additions and 0 deletions

View File

@@ -174,6 +174,56 @@ test -f ns2/zonedir/__catz___default_catalog1.example_dom1.example.db.jnl || ret
if [ $ret -ne 0 ]; then echo_i "failed"; fi if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret)) status=$((status+ret))
n=$((n+1))
echo_i "update catalog zone serial ($n)"
ret=0
# default minimum update rate is once / 5 seconds
sleep 5
$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1
server 10.53.0.1 ${PORT}
update add catalog1.example 3600 SOA . . 20 86400 3600 86400 3600
send
END
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "wait for catalog zone to transfer ($n)"
ret=0
wait_for_soa_equal_20() {
dig_with_opts @10.53.0.2 SOA catalog1.example. > dig.out.test$n || return 1
grep "ANSWER: 1," dig.out.test$n > /dev/null || return 1
grep "status: NOERROR" dig.out.test$n > /dev/null || return 1
grep 'IN.SOA.\. \. 20 ' dig.out.test$n > /dev/null || return 1
}
retry_quiet 10 wait_for_soa_equal_20 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "update dom1.example. again ($n)"
ret=0
$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1
server 10.53.0.1 ${PORT}
update add foo.dom1.example 0 IN TXT added record
send
END
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "wait for secondary to be updated again ($n)"
ret=0
wait_for_txt() {
dig_with_opts @10.53.0.2 TXT foo.dom1.example. > dig.out.test$n || return 1
grep "ANSWER: 1," dig.out.test$n > /dev/null || return 1
grep "status: NOERROR" dig.out.test$n > /dev/null || return 1
grep "IN.TXT." dig.out.test$n > /dev/null || return 1
}
retry_quiet 10 wait_for_txt || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1)) n=$((n+1))
echo_i "removing domain dom1.example. from catalog1 zone ($n)" echo_i "removing domain dom1.example. from catalog1 zone ($n)"
ret=0 ret=0

View File

@@ -494,6 +494,14 @@ dns_catz_zones_merge(dns_catz_zone_t *target, dns_catz_zone_t *newzone) {
zname, czname); zname, czname);
continue; continue;
} }
/*
* Delete the old entry so that it won't accidentally be
* removed as a non-existing entry below.
*/
dns_catz_entry_detach(target, &oentry);
result = isc_ht_delete(target->entries, key, (uint32_t)keysize);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
} }
RUNTIME_CHECK(result == ISC_R_NOMORE); RUNTIME_CHECK(result == ISC_R_NOMORE);
isc_ht_iter_destroy(&iter1); isc_ht_iter_destroy(&iter1);