From: Eric Covener Date: Wed, 10 Aug 2011 02:06:52 +0000 (+0000) Subject: Try to obtain the specific LDAP error code returned during a failed X-Git-Tag: 2.3.15~394 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=293bffa8713e05a3ba8aeacf10260ac8d57c84af;p=thirdparty%2Fapache%2Fhttpd.git Try to obtain the specific LDAP error code returned during a failed ldap_simple_bind(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1156001 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/ldap/util_ldap.c b/modules/ldap/util_ldap.c index e4b9d6fcd04..5a865b647ca 100644 --- a/modules/ldap/util_ldap.c +++ b/modules/ldap/util_ldap.c @@ -459,7 +459,14 @@ static int uldap_simple_bind(util_ldap_connection_t *ldc, char *binddn, int rc; int msgid = ldap_simple_bind(ldc->ldap, binddn, bindpw); if (msgid == -1) { + int ldaprc; ldc->reason = "LDAP: ldap_simple_bind() failed"; +#ifdef LDAP_OPT_ERROR_NUMBER + if (LDAP_SUCCESS == ldap_get_option(ldc->ldap, LDAP_OPT_ERROR_NUMBER, &ldaprc)) return ldaprc; +#endif +#ifdef LDAP_OPT_RESULT_CODE + if (LDAP_SUCCESS == ldap_get_option(ldc->ldap, LDAP_OPT_RESULT_CODE, &ldaprc)) return ldaprc; +#endif /* -1 is LDAP_SERVER_DOWN in openldap, use something else */ return LDAP_OTHER; }