this patch optimizes code for removing deleted zones from BIND instance little bit.

In some cases there are auxiliary zones (= not really served zones) in internal Red-Black tree. Current code tries to remove these auxiliary zones on each zone_refresh attempt.

Everything works fine, because auxiliary zones are detected deeper in zone deletion code. Now plugin prints very confusing message "Zone '%s' has been removed from database." each 'zone_refresh' seconds, again and again. This patch prevents this.

I think it's very very confusing. I spent a lot of time while debugging before I realized where is the problem.

Petr^2 Spacek
>From ce620e1e4bb888d784b8cdfac5ba75182d45b6c3 Mon Sep 17 00:00:00 2001
From: Petr Spacek <pspa...@redhat.com>
Date: Tue, 3 Apr 2012 14:50:12 +0200
Subject: [PATCH] Don't try to remove auxiliary nodes from internal RBT
 Signed-off-by: Petr Spacek <pspa...@redhat.com>

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

diff --git a/src/ldap_helper.c b/src/ldap_helper.c
index d0cde9d..df8b01e 100644
--- a/src/ldap_helper.c
+++ b/src/ldap_helper.c
@@ -1192,6 +1192,14 @@ refresh_zones_from_ldap(ldap_instance_t *ldap_inst)
 			goto next;	
+		/* Do not remove auxilitary (= non-zone) nodes. */
+		dns_name_format(&aname, buf, DNS_NAME_FORMATSIZE);
+		if (!node->data) {
+			log_debug(5,"auxilitary zone/node '%s' will not be removed", buf);
+			goto next;
+		}
@@ -1201,8 +1209,6 @@ refresh_zones_from_ldap(ldap_instance_t *ldap_inst)
 			goto next;		
 		/* Log zone removing. */
-		char buf[255];
-		dns_name_format(&aname, buf, 255);
 		log_debug(1, "Zone '%s' has been removed from database.", buf);
 		delete = ISC_TRUE;

Freeipa-devel mailing list

Reply via email to