Hello,

    Add missing DNS view attach/detach to LDAP instance management code.
    This fixes race condition in BIND shutdown after SIGINT:
    - failing assert caused by use-after-free in dns_zt_find():
    (((zt) != ((void *)0)) && (((const isc__magic_t *)(zt))->magic
    == ((('Z') << 24 | ('T') << 16 | ('b') << 8 | ('l')))))

Petr^2 Spacek
From cc612198a0b7d662557a7c4f71732135e8f43025 Mon Sep 17 00:00:00 2001
From: Petr Spacek <pspa...@redhat.com>
Date: Thu, 13 Sep 2012 13:08:36 +0200
Subject: [PATCH] Add missing DNS view attach/detach to LDAP instance
 management code. This fixes race condition in BIND shutdown
 after SIGINT: - failing assert caused by use-after-free in
 dns_zt_find(): (((zt) != ((void *)0)) && (((const
 isc__magic_t *)(zt))->magic == ((('Z') << 24 | ('T') << 16
 | ('b') << 8 | ('l')))))

Signed-off-by: Petr Spacek <pspa...@redhat.com>
---
 src/ldap_helper.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/ldap_helper.c b/src/ldap_helper.c
index 3b49de809738fef18cae10c38fd3d9c33eef5141..658b960f50b461fa602edf51e955f3bdd4769e1d 100644
--- a/src/ldap_helper.c
+++ b/src/ldap_helper.c
@@ -333,6 +333,7 @@ new_ldap_instance(isc_mem_t *mctx, const char *db_name,
 	unsigned int i;
 	isc_result_t result;
 	ldap_instance_t *ldap_inst;
+	dns_view_t *view = NULL;
 	ld_string_t *auth_method_str = NULL;
 	setting_t ldap_settings[] = {
 		{ "uri",	 no_default_string		},
@@ -369,10 +370,9 @@ new_ldap_instance(isc_mem_t *mctx, const char *db_name,
 
 	isc_mem_attach(mctx, &ldap_inst->mctx);
 	ldap_inst->db_name = db_name;
-	ldap_inst->view = dns_dyndb_get_view(dyndb_args);
+	view = dns_dyndb_get_view(dyndb_args);
+	dns_view_attach(view, &ldap_inst->view);
 	ldap_inst->zmgr = dns_dyndb_get_zonemgr(dyndb_args);
-	/* commented out for now, cause named to hang */
-	//dns_view_attach(view, &ldap_inst->view);
 
 	CHECK(zr_create(mctx, &ldap_inst->zone_register));
 
@@ -616,8 +616,7 @@ destroy_ldap_instance(ldap_instance_t **ldap_instp)
 	str_destroy(&ldap_inst->fake_mname);
 	str_destroy(&ldap_inst->ldap_hostname);
 
-	/* commented out for now, causes named to hang */
-	//dns_view_detach(&ldap_inst->view);
+	dns_view_detach(&ldap_inst->view);
 
 	DESTROYLOCK(&ldap_inst->kinit_lock);
 
-- 
1.7.11.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to