]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Log a warning when catz is told to modify a zone not added by catz
authorAram Sargsyan <aram@isc.org>
Tue, 8 Feb 2022 11:47:48 +0000 (11:47 +0000)
committerAram Sargsyan <aram@isc.org>
Mon, 28 Mar 2022 10:17:56 +0000 (10:17 +0000)
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.

bin/named/server.c

index f27d4c3edaa3437b1ad7a8c14494cf3dca3f57ca..677efed0d3a9bd069ac96adba5a342be44e6d625 100644 (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 {