]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Revert changes to LDAP bind
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 11 Dec 2012 13:39:55 +0000 (13:39 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 11 Dec 2012 13:42:51 +0000 (13:42 +0000)
src/modules/rlm_ldap/rlm_ldap.c

index ebcf2c114cd664cf7e91c8a1ea31e93274f0be76..5931bd1ffbece2cad43126385ec47425186005c3 100644 (file)
@@ -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) {