changeset 9023:4323944abc43 HEAD

LDAP: If LDAP_OPT_ERROR_STRING gives more information, log it.
author Timo Sirainen <tss@iki.fi>
date Tue, 12 May 2009 13:45:08 -0400
parents fc8f3f5a7548
children d59748e6a8e8
files src/auth/db-ldap.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/db-ldap.c	Mon May 11 19:14:31 2009 -0400
+++ b/src/auth/db-ldap.c	Tue May 12 13:45:08 2009 -0400
@@ -205,7 +205,18 @@
 
 const char *ldap_get_error(struct ldap_connection *conn)
 {
-	return ldap_err2string(ldap_get_errno(conn));
+	const char *ret;
+	char *str = NULL;
+
+	ret = ldap_err2string(ldap_get_errno(conn));
+
+	ldap_get_option(conn->ld, LDAP_OPT_ERROR_STRING, (void *)&str);
+	if (str != NULL) {
+		ret = t_strconcat(ret, ", ", str, NULL);
+		ldap_memfree(str);
+	}
+	ldap_set_option(conn->ld, LDAP_OPT_ERROR_STRING, NULL);
+	return ret;
 }
 
 static void ldap_conn_reconnect(struct ldap_connection *conn)