dovecot-2.2: ldap: Improved sub-dn-lookup error message.

dovecot at dovecot.org dovecot at dovecot.org
Tue Mar 26 10:26:03 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/8ca1aba14888
changeset: 16113:8ca1aba14888
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Mar 26 10:25:50 2013 +0200
description:
ldap: Improved sub-dn-lookup error message.

diffstat:

 src/auth/db-ldap.c |  17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r a6f8c4d6252e -r 8ca1aba14888 src/auth/db-ldap.c
--- a/src/auth/db-ldap.c	Mon Mar 25 18:10:16 2013 +0200
+++ b/src/auth/db-ldap.c	Tue Mar 26 10:25:50 2013 +0200
@@ -710,6 +710,7 @@
 			      LDAPMessage *res)
 {
 	struct ldap_request_search *srequest = NULL;
+	const struct ldap_request_named_result *named_res;
 	int ret;
 	bool final_result;
 
@@ -746,10 +747,18 @@
 		struct ldap_request_search *srequest =
 			(struct ldap_request_search *)request;
 
-		auth_request_log_error(request->auth_request, "ldap",
-			"ldap_search(base=%s filter=%s) failed: %s",
-			srequest->base, srequest->filter,
-			ldap_err2string(ret));
+		if (!array_is_created(&request->named_results)) {
+			auth_request_log_error(request->auth_request, "ldap",
+				"ldap_search(base=%s filter=%s) failed: %s",
+				srequest->base, srequest->filter,
+				ldap_err2string(ret));
+		} else {
+			named_res = array_idx(&request->named_results,
+					      request->name_idx);
+			auth_request_log_error(request->auth_request, "ldap",
+				"ldap_search(base=%s) failed: %s",
+				named_res->dn, ldap_err2string(ret));
+		}
 		res = NULL;
 	}
 	if (ret == LDAP_SUCCESS && srequest != NULL && !srequest->multi_entry) {


More information about the dovecot-cvs mailing list