Hello,

    Log successful zone reload after record change.

This should be last piece of
https://fedorahosted.org/bind-dyndb-ldap/ticket/102

--
Petr^2 Spacek
From 06c414c2922bb09c18afd9fadc52b2b0f4529f90 Mon Sep 17 00:00:00 2001
From: Petr Spacek <pspa...@redhat.com>
Date: Thu, 21 Mar 2013 14:43:56 +0100
Subject: [PATCH] Log successful zone reload after record change.

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

diff --git a/src/ldap_helper.c b/src/ldap_helper.c
index 7ac5ceda26cd9d734f94d9195388db879be1959e..72105e6093cea7b0bc9fdfc96229afded7650dce 100644
--- a/src/ldap_helper.c
+++ b/src/ldap_helper.c
@@ -3494,6 +3494,7 @@ update_record(isc_task_t *task, isc_event_t *event)
 	dns_zone_t *zone_ptr = NULL;
 	isc_boolean_t zone_found = ISC_FALSE;
 	isc_boolean_t zone_reloaded = ISC_FALSE;
+	isc_uint32_t serial;
 	mctx = pevent->mctx;
 
 	UNUSED(task);
@@ -3579,8 +3580,7 @@ update_restart:
 		if (serial_autoincrement)
 			CHECK(soa_serial_increment(mctx, inst, &origin));
 		else {
-			isc_uint32_t dummy;
-			CHECK(ldap_get_zone_serial(inst, &origin, &dummy));
+			CHECK(ldap_get_zone_serial(inst, &origin, &serial));
 		}
 	}
 
@@ -3594,16 +3594,23 @@ cleanup:
 		result = zr_get_zone_ptr(inst->zone_register, &origin, &zone_ptr);
 		if (result == ISC_R_SUCCESS)
 			result = dns_zone_load(zone_ptr);
-		if (zone_ptr != NULL)
-			dns_zone_detach(&zone_ptr);
 
 		if (result == ISC_R_SUCCESS || result == DNS_R_UPTODATE ||
 		    result == DNS_R_DYNAMIC || result == DNS_R_CONTINUE) {
 			/* zone reload succeeded, fire current event again */
 			log_debug(1, "restarting update_record after zone reload "
 				     "caused by change in '%s'", pevent->dn);
 			zone_reloaded = ISC_TRUE;
-			goto update_restart;
+			result = dns_zone_getserial2(zone_ptr, &serial);
+			if (result == ISC_R_SUCCESS) {
+				dns_zone_log(zone_ptr, ISC_LOG_INFO,
+					     "reloaded serial %u", serial);
+				goto update_restart;
+			} else {
+				dns_zone_log(zone_ptr, ISC_LOG_ERROR,
+					     "could not get serial after "
+					     "reload");
+			}
 		} else {
 			log_error_r("unable to reload invalid zone; "
 				    "reload triggered by change in '%s'",
@@ -3617,6 +3624,8 @@ cleanup:
 			  pevent->dn, pevent->chgtype);
 	}
 
+	if (zone_ptr != NULL)
+		dns_zone_detach(&zone_ptr);
 	if (dns_name_dynamic(&name))
 		dns_name_free(&name, inst->mctx);
 	if (dns_name_dynamic(&prevname))
-- 
1.7.11.7

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

Reply via email to