From: Arran Cudbard-Bell Date: Tue, 11 Dec 2012 13:39:55 +0000 (+0000) Subject: Revert changes to LDAP bind X-Git-Tag: release_3_0_0_beta1~1380 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e989d6d9819184a052bc728cd1ac58dec9b571f;p=thirdparty%2Ffreeradius-server.git Revert changes to LDAP bind --- diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index ebcf2c114cd..5931bd1ffbe 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -364,7 +364,7 @@ static int ldap_bind_wrapper(LDAP_CONN **pconn, const char *user, const char *password, const char **perror_str, int do_rebind) { - int rcode, ldap_errno; + int rcode, ldap_errno, msg_id; int module_rcode = RLM_MODULE_FAIL; int reconnect = FALSE; const char *error_string; @@ -374,13 +374,13 @@ static int ldap_bind_wrapper(LDAP_CONN **pconn, const char *user, struct timeval tv; redo: - /* - * man ldap_bind says this returns and ldap_error on failure - * when using LDAP_AUTH_SIMPLE. - */ - ldap_errno = ldap_bind(conn->handle, user, password, LDAP_AUTH_SIMPLE); - if (ldap_errno != LDAP_SUCCESS) { + msg_id = ldap_bind(conn->handle, user, password, + LDAP_AUTH_SIMPLE); + if (msg_id < 0) { get_error: + ldap_get_option(conn->handle, LDAP_OPT_ERROR_NUMBER, + &ldap_errno); + error_string = ldap_err2string(ldap_errno); if (do_rebind && !reconnect) {