PATCH: Verbose error reporting for dlz_ldap

Jan Engelhardt jengelh at medozas.de
Thu Feb 24 16:12:33 UTC 2011


---
I had an error in my LDAP tree, but

named[14453]: LDAP driver failed while sending data to Bind.

did not tell me anything. So I devised this patch that is
more verbose about which entry (among the hundreds) is wrong.
Example:

named[14453]: dlz-ldap: put failed for
"@ MXdeactivated 7200 9001 ares", error 65543

---
 contrib/dlz/drivers/dlz_ldap_driver.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Index: bind-9.7.1P2/contrib/dlz/drivers/dlz_ldap_driver.c
===================================================================
--- bind-9.7.1P2.orig/contrib/dlz/drivers/dlz_ldap_driver.c
+++ bind-9.7.1P2/contrib/dlz/drivers/dlz_ldap_driver.c
@@ -499,14 +499,21 @@ ldap_process_results(LDAP *dbc, LDAPMess
 			goto cleanup;
 		}
 		if (allnodes == isc_boolean_true) {
-			if (strcasecmp(host, "~") == 0)
+			if (strcasecmp(host, "~") == 0) {
 				result = dns_sdlz_putnamedrr(
 						(dns_sdlzallnodes_t *) ptr,
 						"*", type, ttl, data);
-			else
+			} else {
 				result = dns_sdlz_putnamedrr(
 						(dns_sdlzallnodes_t *) ptr,
 						host, type, ttl, data);
+				if (result != ISC_R_SUCCESS)
+					isc_log_write(dns_lctx,
+						DNS_LOGCATEGORY_DATABASE,
+						DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
+						"dlz-ldap: put failed for \"%s %s %u %s\", error %d",
+						host, type, ttl, data, result);
+			}
 		}
 		else
 			result = dns_sdlz_putrr((dns_sdlzlookup_t *) ptr,




More information about the bind-workers mailing list