Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix zone removal to respect forward configuration inheritance.
Ad-hoc fwd_delete_table() calls did not respect inheritance hierarchy
in forwarding configuration. Now all manipulation with forward table
is done in fwd_configure_zone() and fully respects configuration inheritance.

There is a trick: When removing or deactivating a zone, fwd_configure_zone()
is called with empty configuration set to simulate that the zone does
not have any explicit configuration. This triggers the inheritance
logic when necessary (i.e. for the root zone).

https://fedorahosted.org/bind-dyndb-ldap/ticket/167
  • Loading branch information
pspacek committed Aug 12, 2016
1 parent b409762 commit d6e413c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ldap_helper.c
Expand Up @@ -1301,8 +1301,8 @@ ldap_delete_zone2(ldap_instance_t *inst, dns_name_t *name, isc_boolean_t lock)
if (lock)
run_exclusive_enter(inst, &lock_state);

CHECK(fwd_delete_table(inst->view, name, "zone",
zone_name_char));
/* simulate no explicit forwarding configuration */
CHECK(fwd_configure_zone(&inst->empty_fwdz_settings, inst, name));
isforward = fwdr_zone_ispresent(inst->fwd_register, name);
if (isforward == ISC_R_SUCCESS)
CHECK(fwdr_del_zone(inst->fwd_register, name));
Expand All @@ -1312,8 +1312,7 @@ ldap_delete_zone2(ldap_instance_t *inst, dns_name_t *name, isc_boolean_t lock)
if (isforward == ISC_R_SUCCESS)
log_info("forward zone '%s': shutting down", zone_name_char);
log_debug(1, "zone '%s' not found in zone register", zone_name_char);
result = dns_view_flushcache(inst->view);
goto cleanup;
CLEANUP_WITH(ISC_R_SUCCESS);
} else if (result != ISC_R_SUCCESS)
goto cleanup;

Expand Down Expand Up @@ -1373,7 +1372,8 @@ unpublish_zone(ldap_instance_t *inst, dns_name_t *name, const char *logname) {
}
CHECK(dns_view_findzone(inst->view, name, &zone_in_view));
INSIST(zone_in_view == raw || zone_in_view == secure);
CHECK(fwd_delete_table(inst->view, name, "zone", logname));
/* simulate no explicit forwarding configuration */
CHECK(fwd_configure_zone(&inst->empty_fwdz_settings, inst, name));
CHECK(dns_zt_unmount(inst->view->zonetable, zone_in_view));

cleanup:
Expand Down

0 comments on commit d6e413c

Please sign in to comment.