On 03/23/2012 12:25 PM, Adam Tkac wrote:
On 03/23/2012 09:59 AM, Petr Spacek wrote:
Hello,

this patch fixes crash on reload/halt. Current code will crash if no
zones were loaded from LDAP (because of connection error or bad DN in
config).

There is no BZ/ticket for this issue.

This patch is fine and fixes
https://bugzilla.redhat.com/show_bug.cgi?id=805814

Before you push it, please add comment to code that there still might be
issues with the RUNTIME_CHECK when nodechain_first returns ISC_R_NOMEMORY.

Regards, Adam

Comment added, pushed to master.

https://fedorahosted.org/bind-dyndb-ldap/changeset/f35661ac8fd7fe3a778ad95fc5135bf332230453

Note: BZ 805814 was reported after patch was sent to list :-)

Petr^2 Spacek

bind-dyndb-ldap-pspacek-0014-Fix-crash-on-reload-without-any-zones.patch


From 4f10354d7dcff6bff7421cc4594ec06da32da765 Mon Sep 17 00:00:00 2001
From: Petr Spacek<pspa...@redhat.com>
Date: Fri, 23 Mar 2012 09:50:44 +0100
Subject: [PATCH] Fix crash on reload without any zones. Signed-off-by:
Petr
Spacek<pspa...@redhat.com>

---
src/ldap_helper.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/ldap_helper.c b/src/ldap_helper.c
index 971d90f..e9ed7ca 100644
--- a/src/ldap_helper.c
+++ b/src/ldap_helper.c
@@ -504,9 +504,10 @@ destroy_ldap_instance(ldap_instance_t **ldap_instp)
rbt = zr_get_rbt(ldap_inst->zone_register);

result = dns_rbtnodechain_first(&chain, rbt, NULL, NULL);
- RUNTIME_CHECK(result == ISC_R_SUCCESS || result == DNS_R_NEWORIGIN);
+ RUNTIME_CHECK(result == ISC_R_SUCCESS || result == DNS_R_NEWORIGIN
+ || result == ISC_R_NOTFOUND);

- while (result != ISC_R_NOMORE) {
+ while (result != ISC_R_NOMORE&& result != ISC_R_NOTFOUND) {
dns_fixedname_t name;
dns_fixedname_init(&name);
result = dns_rbtnodechain_current(&chain, NULL,


>From f35661ac8fd7fe3a778ad95fc5135bf332230453 Mon Sep 17 00:00:00 2001
From: Petr Spacek <pspa...@redhat.com>
Date: Fri, 23 Mar 2012 09:50:44 +0100
Subject: [PATCH] Fix crash on reload without any zones. Signed-off-by: Petr
 Spacek <pspa...@redhat.com>

---
 src/ldap_helper.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/ldap_helper.c b/src/ldap_helper.c
index 971d90f..da6b2f4 100644
--- a/src/ldap_helper.c
+++ b/src/ldap_helper.c
@@ -503,10 +503,15 @@ destroy_ldap_instance(ldap_instance_t **ldap_instp)
 	dns_rbtnodechain_init(&chain, ldap_inst->mctx);
 	rbt = zr_get_rbt(ldap_inst->zone_register);
 
+	/* Potentially ISC_R_NOSPACE can occur. Destroy codepath has no way to
+	 * return errors, so kill BIND.
+	 * DNS_R_NAMETOOLONG should never happen, because all names were checked
+	 * while loading. */
 	result = dns_rbtnodechain_first(&chain, rbt, NULL, NULL);
-	RUNTIME_CHECK(result == ISC_R_SUCCESS || result == DNS_R_NEWORIGIN);
+	RUNTIME_CHECK(result == ISC_R_SUCCESS || result == DNS_R_NEWORIGIN
+			|| result == ISC_R_NOTFOUND);
 
-	while (result != ISC_R_NOMORE) {
+	while (result != ISC_R_NOMORE && result != ISC_R_NOTFOUND) {
 		dns_fixedname_t name;
 		dns_fixedname_init(&name);
 		result = dns_rbtnodechain_current(&chain, NULL,
-- 
1.7.7.6

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

Reply via email to