|
|
f3daad |
From 3b44a3d73a0d1980b43e9022d9249c4c19ba56d2 Mon Sep 17 00:00:00 2001
|
|
|
f3daad |
From: Petr Spacek <pspacek@redhat.com>
|
|
|
f3daad |
Date: Thu, 11 Aug 2016 12:40:39 +0200
|
|
|
f3daad |
Subject: [PATCH] Remove preserve_forwarding parameter from
|
|
|
f3daad |
ldap_delete_zone2().
|
|
|
f3daad |
|
|
|
f3daad |
The parameter was TRUE only when called from zone_security_change().
|
|
|
f3daad |
zone_security_change() is calling ldap_delete_zone2() in exclusive mode
|
|
|
f3daad |
anyway so there is no need to optimize this.
|
|
|
f3daad |
|
|
|
f3daad |
Removal of the parameter will make easier to centralize forwarding
|
|
|
f3daad |
configuration on one place.
|
|
|
f3daad |
|
|
|
f3daad |
https://fedorahosted.org/bind-dyndb-ldap/ticket/167
|
|
|
f3daad |
---
|
|
|
f3daad |
src/ldap_helper.c | 26 ++++++++++----------------
|
|
|
f3daad |
src/ldap_helper.h | 3 +--
|
|
|
f3daad |
src/zone_register.c | 2 +-
|
|
|
f3daad |
3 files changed, 12 insertions(+), 19 deletions(-)
|
|
|
f3daad |
|
|
|
f3daad |
diff --git a/src/ldap_helper.c b/src/ldap_helper.c
|
|
|
f3daad |
index 12a743b095ba400373cb87653d26af82cc95c2ea..696a755fb8001993ff1a16fa034a9286cbb5ad89 100644
|
|
|
f3daad |
--- a/src/ldap_helper.c
|
|
|
f3daad |
+++ b/src/ldap_helper.c
|
|
|
f3daad |
@@ -1285,8 +1285,7 @@ configure_zone_ssutable(dns_zone_t *zone, const char *update_str)
|
|
|
f3daad |
|
|
|
f3daad |
/* Delete zone by dns zone name */
|
|
|
f3daad |
isc_result_t
|
|
|
f3daad |
-ldap_delete_zone2(ldap_instance_t *inst, dns_name_t *name, isc_boolean_t lock,
|
|
|
f3daad |
- isc_boolean_t preserve_forwarding)
|
|
|
f3daad |
+ldap_delete_zone2(ldap_instance_t *inst, dns_name_t *name, isc_boolean_t lock)
|
|
|
f3daad |
{
|
|
|
f3daad |
isc_result_t result;
|
|
|
f3daad |
isc_result_t isforward = ISC_R_NOTFOUND;
|
|
|
f3daad |
@@ -1302,13 +1301,11 @@ ldap_delete_zone2(ldap_instance_t *inst, dns_name_t *name, isc_boolean_t lock,
|
|
|
f3daad |
if (lock)
|
|
|
f3daad |
run_exclusive_enter(inst, &lock_state);
|
|
|
f3daad |
|
|
|
f3daad |
- if (!preserve_forwarding) {
|
|
|
f3daad |
- CHECK(fwd_delete_table(inst->view, name, "zone",
|
|
|
f3daad |
- zone_name_char));
|
|
|
f3daad |
- isforward = fwdr_zone_ispresent(inst->fwd_register, name);
|
|
|
f3daad |
- if (isforward == ISC_R_SUCCESS)
|
|
|
f3daad |
- CHECK(fwdr_del_zone(inst->fwd_register, name));
|
|
|
f3daad |
- }
|
|
|
f3daad |
+ CHECK(fwd_delete_table(inst->view, name, "zone",
|
|
|
f3daad |
+ zone_name_char));
|
|
|
f3daad |
+ isforward = fwdr_zone_ispresent(inst->fwd_register, name);
|
|
|
f3daad |
+ if (isforward == ISC_R_SUCCESS)
|
|
|
f3daad |
+ CHECK(fwdr_del_zone(inst->fwd_register, name));
|
|
|
f3daad |
|
|
|
f3daad |
result = zr_get_zone_ptr(inst->zone_register, name, &raw, &secure);
|
|
|
f3daad |
if (result == ISC_R_NOTFOUND || result == DNS_R_PARTIALMATCH) {
|
|
|
f3daad |
@@ -1487,8 +1484,7 @@ ldap_parse_fwd_zoneentry(ldap_entry_t *entry, ldap_instance_t *inst)
|
|
|
f3daad |
if (HEAD(values) != NULL &&
|
|
|
f3daad |
strcasecmp(HEAD(values)->value, "TRUE") != 0) {
|
|
|
f3daad |
/* Zone is not active */
|
|
|
f3daad |
- result = ldap_delete_zone2(inst, &entry->fqdn,
|
|
|
f3daad |
- ISC_TRUE, ISC_FALSE);
|
|
|
f3daad |
+ result = ldap_delete_zone2(inst, &entry->fqdn, ISC_TRUE);
|
|
|
f3daad |
goto cleanup;
|
|
|
f3daad |
}
|
|
|
f3daad |
|
|
|
f3daad |
@@ -1990,7 +1986,7 @@ zone_security_change(ldap_entry_t * const entry, dns_name_t * const name,
|
|
|
f3daad |
* in period where old zone was deleted but the new zone was not
|
|
|
f3daad |
* created yet. */
|
|
|
f3daad |
run_exclusive_enter(inst, &lock_state);
|
|
|
f3daad |
- CHECK(ldap_delete_zone2(inst, name, ISC_FALSE, ISC_TRUE));
|
|
|
f3daad |
+ CHECK(ldap_delete_zone2(inst, name, ISC_FALSE));
|
|
|
f3daad |
CHECK(ldap_parse_master_zoneentry(entry, olddb, inst, task));
|
|
|
f3daad |
|
|
|
f3daad |
cleanup:
|
|
|
f3daad |
@@ -2173,8 +2169,7 @@ cleanup:
|
|
|
f3daad |
log_error_r("%s: publishing failed, rolling back due to",
|
|
|
f3daad |
ldap_entry_logname(entry));
|
|
|
f3daad |
/* TODO: verify this */
|
|
|
f3daad |
- result = ldap_delete_zone2(inst, &entry->fqdn,
|
|
|
f3daad |
- ISC_TRUE, ISC_FALSE);
|
|
|
f3daad |
+ result = ldap_delete_zone2(inst, &entry->fqdn, ISC_TRUE);
|
|
|
f3daad |
if (result != ISC_R_SUCCESS)
|
|
|
f3daad |
log_error_r("%s: rollback failed: ",
|
|
|
f3daad |
ldap_entry_logname(entry));
|
|
|
f3daad |
@@ -3671,8 +3666,7 @@ update_zone(isc_task_t *task, isc_event_t *event)
|
|
|
f3daad |
INSIST(task == inst->task); /* For task-exclusive mode */
|
|
|
f3daad |
|
|
|
f3daad |
if (SYNCREPL_DEL(pevent->chgtype)) {
|
|
|
f3daad |
- CHECK(ldap_delete_zone2(inst, &entry->fqdn,
|
|
|
f3daad |
- ISC_TRUE, ISC_FALSE));
|
|
|
f3daad |
+ CHECK(ldap_delete_zone2(inst, &entry->fqdn, ISC_TRUE));
|
|
|
f3daad |
} else {
|
|
|
f3daad |
if (entry->class & LDAP_ENTRYCLASS_MASTER)
|
|
|
f3daad |
CHECK(ldap_parse_master_zoneentry(entry, NULL, inst,
|
|
|
f3daad |
diff --git a/src/ldap_helper.h b/src/ldap_helper.h
|
|
|
f3daad |
index 0368ec7343ef7b16e7afb25b17f3067bf7c09f76..a491baeb41105b9a352dbad6949c3fab008ab69b 100644
|
|
|
f3daad |
--- a/src/ldap_helper.h
|
|
|
f3daad |
+++ b/src/ldap_helper.h
|
|
|
f3daad |
@@ -46,8 +46,7 @@ new_ldap_instance(isc_mem_t *mctx, const char *db_name,
|
|
|
f3daad |
void destroy_ldap_instance(ldap_instance_t **ldap_inst) ATTR_NONNULLS;
|
|
|
f3daad |
|
|
|
f3daad |
isc_result_t
|
|
|
f3daad |
-ldap_delete_zone2(ldap_instance_t *inst, dns_name_t *name,
|
|
|
f3daad |
- isc_boolean_t lock, isc_boolean_t preserve_forwarding)
|
|
|
f3daad |
+ldap_delete_zone2(ldap_instance_t *inst, dns_name_t *name, isc_boolean_t lock)
|
|
|
f3daad |
ATTR_NONNULLS;
|
|
|
f3daad |
|
|
|
f3daad |
/* Functions for writing to LDAP. */
|
|
|
f3daad |
diff --git a/src/zone_register.c b/src/zone_register.c
|
|
|
f3daad |
index 3f8c070b3adfb0ecc5092eb1e84f3956ba3b4fb8..bde4a7c308a6a62ebe6b9123b3212a404603310a 100644
|
|
|
f3daad |
--- a/src/zone_register.c
|
|
|
f3daad |
+++ b/src/zone_register.c
|
|
|
f3daad |
@@ -163,7 +163,7 @@ zr_destroy(zone_register_t **zrp)
|
|
|
f3daad |
if (result == ISC_R_SUCCESS) {
|
|
|
f3daad |
rbt_iter_stop(&iter);
|
|
|
f3daad |
result = ldap_delete_zone2(zr->ldap_inst,
|
|
|
f3daad |
- &name, ISC_FALSE, ISC_FALSE);
|
|
|
f3daad |
+ &name, ISC_FALSE);
|
|
|
f3daad |
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
|
|
f3daad |
}
|
|
|
f3daad |
} while (result == ISC_R_SUCCESS);
|
|
|
f3daad |
--
|
|
|
f3daad |
2.7.4
|
|
|
f3daad |
|