From: Aram Sargsyan Date: Tue, 8 Feb 2022 11:47:48 +0000 (+0000) Subject: Log a warning when catz is told to modify a zone not added by catz X-Git-Tag: v9.19.0~42^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d29e5f197b630c202d49efa1a6f9bcab7a02ee48;p=thirdparty%2Fbind9.git 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. --- diff --git a/bin/named/server.c b/bin/named/server.c index f27d4c3edaa..677efed0d3a 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 {