[dovecot-cvs] dovecot/src/auth passdb-ldap.c,1.44.2.6,1.44.2.7

tss at dovecot.org tss at dovecot.org
Sat Nov 4 21:08:43 UTC 2006


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv506

Modified Files:
      Tag: branch_1_0
	passdb-ldap.c 
Log Message:
Fixes to auth_bind.



Index: passdb-ldap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-ldap.c,v
retrieving revision 1.44.2.6
retrieving revision 1.44.2.7
diff -u -d -r1.44.2.6 -r1.44.2.7
--- passdb-ldap.c	4 Nov 2006 20:22:30 -0000	1.44.2.6
+++ passdb-ldap.c	4 Nov 2006 21:08:41 -0000	1.44.2.7
@@ -251,23 +251,27 @@
 	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);



More information about the dovecot-cvs mailing list