Hello, Do not apply forwarding configuration for disabled master zones.
We have to respect idnsZoneActive attribute when calling fwd_configure_zone(). https://fedorahosted.org/bind-dyndb-ldap/ticket/164 -- Petr^2 Spacek
From 1c59eeb30b5a3bf5a1b7626b029f400b86821554 Mon Sep 17 00:00:00 2001 From: Petr Spacek <pspa...@redhat.com> Date: Tue, 7 Jun 2016 16:58:43 +0200 Subject: [PATCH] Do not apply forwarding configuration for disabled master zones. We have to respect idnsZoneActive attribute when calling fwd_configure_zone(). https://fedorahosted.org/bind-dyndb-ldap/ticket/164 --- src/ldap_helper.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/ldap_helper.c b/src/ldap_helper.c index 59a394d08bee893f12bf05b3bab4e9c8cc4a559c..c7a4c04e37cd2ef872efc0849bec7782fd024730 100644 --- a/src/ldap_helper.c +++ b/src/ldap_helper.c @@ -155,6 +155,7 @@ struct ldap_instance { /* Settings. */ settings_set_t *local_settings; settings_set_t *global_settings; + settings_set_t empty_fwdz_settings; sync_ctx_t *sctx; mldapdb_t *mldapdb; @@ -255,6 +256,12 @@ static setting_t settings_global_default[] = { end_of_settings }; +static setting_t settings_fwdz_defaults[] = { + { "forward_policy", no_default_string }, + { "forwarders", no_default_string }, + end_of_settings +}; + /* * Forward declarations. */ @@ -593,6 +600,14 @@ new_ldap_instance(isc_mem_t *mctx, const char *db_name, if (settings_set_isfilled(ldap_inst->global_settings) != ISC_TRUE) CLEANUP_WITH(ISC_R_FAILURE); + ldap_inst->empty_fwdz_settings = (settings_set_t) { + NULL, + "dummy LDAP zone forwarding settings", + ldap_inst->global_settings, + NULL, + (setting_t *) &settings_fwdz_defaults[0] + }; + CHECK(setting_get_uint("connections", ldap_inst->local_settings, &connections)); CHECK(zr_create(mctx, ldap_inst, ldap_inst->global_settings, @@ -1148,6 +1163,10 @@ activate_zones(isc_task_t *task, ldap_instance_t *inst) { result = activate_zone(task, inst, &name); if (result == ISC_R_SUCCESS) ++published_cnt; + result = fwd_configure_zone(settings, inst, &name); + if (result != ISC_R_SUCCESS) + log_error_r("could not configure forwarding"); + } }; @@ -1404,11 +1423,6 @@ ldap_parse_fwd_zoneentry(ldap_entry_t *entry, ldap_instance_t *inst) char name_txt[DNS_NAME_FORMATSIZE]; isc_result_t result; - static const setting_t fwdz_defaults[] = { - { "forward_policy", no_default_string }, - { "forwarders", no_default_string }, - end_of_settings - }; settings_set_t *fwdz_settings = NULL; REQUIRE(entry != NULL); @@ -1424,7 +1438,7 @@ ldap_parse_fwd_zoneentry(ldap_entry_t *entry, ldap_instance_t *inst) goto cleanup; } - CHECK(settings_set_create(inst->mctx, fwdz_defaults, sizeof(fwdz_defaults), + CHECK(settings_set_create(inst->mctx, settings_fwdz_defaults, sizeof(settings_fwdz_defaults), "fake fwdz settings", inst->global_settings, &fwdz_settings)); result = fwd_parse_ldap(entry, fwdz_settings); @@ -2011,12 +2025,7 @@ ldap_parse_master_zoneentry(ldap_entry_t * const entry, dns_db_t * const olddb, &zone_settings)); CHECK(zone_master_reconfigure(entry, zone_settings, raw, secure, task)); result = fwd_parse_ldap(entry, zone_settings); - if (result == ISC_R_SUCCESS) { - result = fwd_configure_zone(zone_settings, inst, &entry->fqdn); - if (result != ISC_R_SUCCESS) - log_error_r("%s: could not configure forwarding", - ldap_entry_logname(entry)); - } else if (result != ISC_R_IGNORE) + if (result != ISC_R_SUCCESS && result != ISC_R_IGNORE) goto cleanup; /* synchronize zone origin with LDAP */ CHECK(zr_get_zone_dbs(inst->zone_register, &entry->fqdn, &ldapdb, &rbtdb)); @@ -2080,9 +2089,13 @@ ldap_parse_master_zoneentry(ldap_entry_t * const entry, dns_db_t * const olddb, if (new_zone == ISC_TRUE || activity_changed == ISC_TRUE) CHECK(publish_zone(task, inst, toview)); CHECK(load_zone(toview, ISC_FALSE)); + CHECK(fwd_configure_zone(zone_settings, inst, &entry->fqdn)); } else if (activity_changed == ISC_TRUE) { /* Zone was deactivated */ CHECK(unpublish_zone(inst, &entry->fqdn, ldap_entry_logname(entry))); + /* emulate "no explicit forwarding config" */ + CHECK(fwd_configure_zone(&inst->empty_fwdz_settings, inst, + &entry->fqdn)); dns_zone_log(toview, ISC_LOG_INFO, "zone deactivated " "and removed from view"); } -- 2.5.5
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code