]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check if catz is active in dns__catz_timer_cb()
authorAram Sargsyan <aram@isc.org>
Thu, 2 Mar 2023 13:19:53 +0000 (13:19 +0000)
committerAram Sargsyan <aram@isc.org>
Thu, 2 Mar 2023 17:40:10 +0000 (17:40 +0000)
A reconfiguration can deactivate the catalog zone, while the
update process was deferred using a timer.

lib/dns/catz.c

index f02784c659f165ae6e58be578b4c39ffd1ebadf5..c878c792877a1f0ae8ae2937a9f5186914a9b871 100644 (file)
@@ -2096,6 +2096,7 @@ dns__catz_timer_cb(void *arg) {
        LOCK(&catz->catzs->lock);
 
        INSIST(DNS_DB_VALID(catz->db));
+       INSIST(catz->dbversion != NULL);
        INSIST(catz->updb == NULL);
        INSIST(catz->updbversion == NULL);
 
@@ -2103,12 +2104,22 @@ dns__catz_timer_cb(void *arg) {
        catz->updaterunning = true;
        catz->updateresult = ISC_R_UNSET;
 
+       dns_name_format(&catz->name, domain, DNS_NAME_FORMATSIZE);
+
+       if (!catz->active) {
+               isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
+                             DNS_LOGMODULE_MASTER, ISC_LOG_INFO,
+                             "catz: %s: no longer active, reload is canceled",
+                             domain);
+               catz->updaterunning = false;
+               catz->updateresult = ISC_R_CANCELED;
+               goto exit;
+       }
+
        dns_db_attach(catz->db, &catz->updb);
-       INSIST(catz->dbversion != NULL);
        catz->updbversion = catz->dbversion;
        catz->dbversion = NULL;
 
-       dns_name_format(&catz->name, domain, DNS_NAME_FORMATSIZE);
        isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_MASTER,
                      ISC_LOG_INFO, "catz: %s: reload start", domain);
 
@@ -2116,6 +2127,7 @@ dns__catz_timer_cb(void *arg) {
        isc_work_enqueue(catz->loop, dns__catz_update_cb, dns__catz_done_cb,
                         catz);
 
+exit:
        isc_timer_destroy(&catz->updatetimer);
        catz->loop = NULL;