dovecot-1.2: LDAP: If LDAP_OPT_ERROR_STRING gives more informati...

dovecot at dovecot.org dovecot at dovecot.org
Tue May 12 20:45:43 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/4323944abc43
changeset: 9023:4323944abc43
user:      Timo Sirainen <tss at iki.fi>
date:      Tue May 12 13:45:08 2009 -0400
description:
LDAP: If LDAP_OPT_ERROR_STRING gives more information, log it.

diffstat:

1 file changed, 12 insertions(+), 1 deletion(-)
src/auth/db-ldap.c |   13 ++++++++++++-

diffs (23 lines):

diff -r fc8f3f5a7548 -r 4323944abc43 src/auth/db-ldap.c
--- 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 @@ static int ldap_get_errno(struct ldap_co
 
 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)


More information about the dovecot-cvs mailing list