Cleanup the dns_catz unit API

1. Change the _new, _add and _copy functions to return the new object
   instead of returning 'void' (or always ISC_R_SUCCESS)

2. Cleanup the isc_ht_find() + isc_ht_add() usage - the code is always
   locked with catzs->lock (mutex), so when isc_ht_find() returns
   ISC_R_NOTFOUND, the isc_ht_add() must always succeed.

3. Instead of returning direct iterator for the catalog zone entries,
   add dns_catz_zone_for_each_entry2() function that calls callback
   for each catalog zone entry and passes two extra arguments to the
   callback.  This will allow changing the internal storage for the
   catalog zone entries.

4. Cleanup the naming - dns_catz_<fn>_<obj> -> dns_catz_<obj>_<fn>, as an
   example dns_catz_new_zone() gets renamed to dns_catz_zone_new().
This commit is contained in:
Ondřej Surý
2023-07-12 09:22:11 +02:00
parent aad9fda87d
commit 48714a9c1d
6 changed files with 189 additions and 251 deletions

View File

@@ -85,8 +85,7 @@ n=0
n=$((n+1))
echo_i "checking that catalog-bad1.example (with no version) has failed to load ($n)"
ret=0
wait_for_message ns2/named.run "catz: zone 'catalog-bad1.example' has no 'version' record" &&
wait_for_message ns2/named.run "catz: new catalog zone 'catalog-bad1.example' is broken and will not be processed" || ret=1
wait_for_message ns2/named.run "catz: zone 'catalog-bad1.example' has no 'version' record and will not be processed" &&
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
@@ -122,7 +121,7 @@ echo_i "checking that catalog-bad5.example (non-IN class) has failed to load ($n
ret=0
wait_for_message ns2/named.run "'catalog-zones' option is only supported for views with class IN" &&
wait_for_message ns2/named.run "all zones loaded" || ret=1
grep -F "catz: dns_catz_add_zone catalog-bad5.example" ns2/named.run && ret=1
grep -F "catz: dns_catz_zone_add catalog-bad5.example" ns2/named.run && ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))