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 d29e5f197b)
This commit is contained in:
Aram Sargsyan 2022-02-08 11:47:48 +00:00
parent 3c3653ad2a
commit c79c059c4e

View file

@ -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 {