Mercurial > dovecot > original-hg > dovecot-1.2
changeset 4752:e2493679cd0a HEAD
Fixes to auth_bind.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 04 Nov 2006 23:08:42 +0200 |
parents | aadf124d273f |
children | 22e40b2c1c60 |
files | src/auth/passdb-ldap.c |
diffstat | 1 files changed, 19 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/passdb-ldap.c Sat Nov 04 22:55:16 2006 +0200 +++ b/src/auth/passdb-ldap.c Sat Nov 04 23:08:42 2006 +0200 @@ -251,24 +251,28 @@ struct auth_request *auth_request = ldap_request->context; int msgid; - /* switch back to the default dn before doing the next search request */ - conn->last_auth_bind = TRUE; + if (!conn->connecting) { + /* switch back to the default dn before doing the next search + request */ + conn->last_auth_bind = TRUE; - /* the DN is kept in base variable, a bit ugly.. */ - msgid = ldap_bind(conn->ld, ldap_request->base, - auth_request->mech_password, LDAP_AUTH_SIMPLE); - if (msgid == -1) { - i_error("ldap_bind(%s) failed: %s", - ldap_request->base, ldap_get_error(conn)); - passdb_ldap_request->callback. - verify_plain(PASSDB_RESULT_INTERNAL_FAILURE, - auth_request); - return; + /* the DN is kept in base variable, a bit ugly.. */ + msgid = ldap_bind(conn->ld, ldap_request->base, + auth_request->mech_password, + LDAP_AUTH_SIMPLE); + if (msgid == -1) { + i_error("ldap_bind(%s) failed: %s", + ldap_request->base, ldap_get_error(conn)); + passdb_ldap_request->callback. + verify_plain(PASSDB_RESULT_INTERNAL_FAILURE, + auth_request); + return; + } + + auth_request_log_debug(auth_request, "ldap", "bind: dn=%s", + ldap_request->base); } - auth_request_log_debug(auth_request, "ldap", "bind: dn=%s", - ldap_request->base); - /* Bind started */ auth_request_ref(auth_request); hash_insert(conn->requests, POINTER_CAST(msgid), ldap_request);