[dovecot-cvs] dovecot/src/auth passdb-ldap.c,1.54,1.55

tss at dovecot.org tss at dovecot.org
Sun Nov 12 12:59:55 UTC 2006


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

Modified Files:
	passdb-ldap.c 
Log Message:
Cleanups, extra assert



Index: passdb-ldap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-ldap.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- passdb-ldap.c	12 Nov 2006 12:13:44 -0000	1.54
+++ passdb-ldap.c	12 Nov 2006 12:59:51 -0000	1.55
@@ -221,25 +221,18 @@
 		passdb_handle_credentials(passdb_result, password, scheme,
 			ldap_request->callback.lookup_credentials,
 			auth_request);
-		auth_request_unref(&auth_request);
-		return;
-	}
+	} else {
+		if (password != NULL) {
+			ret = auth_request_password_verify(auth_request,
+					auth_request->mech_password,
+					password, scheme, "ldap");
+			passdb_result = ret > 0 ? PASSDB_RESULT_OK :
+				PASSDB_RESULT_PASSWORD_MISMATCH;
+		}
 
-	/* verify plain */
-	if (password == NULL) {
 		ldap_request->callback.verify_plain(passdb_result,
 						    auth_request);
-		auth_request_unref(&auth_request);
-		return;
 	}
-
-	ret = auth_request_password_verify(auth_request,
-					   auth_request->mech_password,
-					   password, scheme, "ldap");
-
-	ldap_request->callback.verify_plain(ret > 0 ? PASSDB_RESULT_OK :
-					    PASSDB_RESULT_PASSWORD_MISMATCH,
-					    auth_request);
 	auth_request_unref(&auth_request);
 }
 
@@ -251,6 +244,8 @@
 	struct auth_request *auth_request = ldap_request->context;
 	int msgid;
 
+	i_assert(ldap_request->base != NULL);
+
 	if (conn->connected) {
 		/* switch back to the default dn before doing the next search
 		   request */
@@ -261,7 +256,8 @@
 				  auth_request->mech_password,
 				  LDAP_AUTH_SIMPLE);
 		if (msgid == -1) {
-			i_error("ldap_bind(%s) failed: %s",
+			auth_request_log_error(auth_request, "ldap",
+				"ldap_bind(%s) failed: %s",
 				ldap_request->base, ldap_get_error(conn));
 			passdb_ldap_request->callback.
 				verify_plain(PASSDB_RESULT_INTERNAL_FAILURE,



More information about the dovecot-cvs mailing list