From c79c059c4ea278a332ac80548f3f0792202daa16 Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Tue, 8 Feb 2022 11:47:48 +0000 Subject: [PATCH] Log a warning when catz is told to modify a zone not added by catz Catz logs a warning message when it is told to modify a zone which was not added by the current catalog zone. When logging a warning, distinguish the two cases when the zone was not added by a catalog zone at all, and when the zone was added by a different catalog zone. (cherry picked from commit d29e5f197b630c202d49efa1a6f9bcab7a02ee48) --- bin/named/server.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/bin/named/server.c b/bin/named/server.c index 088d63352c..7c77a8e0bd 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -2689,6 +2689,8 @@ catz_addmodzone_taskaction(isc_task_t *task, isc_event_t *event0) { isc_result_totext(result), nameb); goto cleanup; } else { + dns_catz_zone_t *parentcatz; + if (!dns_zone_getadded(zone)) { isc_log_write( named_g_lctx, NAMED_LOGCATEGORY_GENERAL, @@ -2700,7 +2702,20 @@ catz_addmodzone_taskaction(isc_task_t *task, isc_event_t *event0) { nameb); goto cleanup; } - if (dns_zone_get_parentcatz(zone) != ev->origin) { + + parentcatz = dns_zone_get_parentcatz(zone); + + if (parentcatz == NULL) { + isc_log_write( + named_g_lctx, NAMED_LOGCATEGORY_GENERAL, + NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING, + "catz: catz_addmodzone_taskaction: " + "zone '%s' exists and is not added by " + "a catalog zone, so won't be modified", + nameb); + goto cleanup; + } + if (parentcatz != ev->origin) { isc_log_write( named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING, @@ -2710,6 +2725,7 @@ catz_addmodzone_taskaction(isc_task_t *task, isc_event_t *event0) { nameb); goto cleanup; } + dns_zone_detach(&zone); } } else {