[dovecot-cvs] dovecot/src/auth db-ldap.c, 1.23, 1.24 userdb-ldap.c, 1.17, 1.18 passdb-ldap.c, 1.14, 1.15

cras at dovecot.org cras at dovecot.org
Sun Dec 19 07:30:23 EET 2004


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

Modified Files:
	db-ldap.c userdb-ldap.c passdb-ldap.c 
Log Message:
Fixed crashing due to free()ing too much.



Index: db-ldap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/db-ldap.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- db-ldap.c	20 Sep 2004 21:47:30 -0000	1.23
+++ db-ldap.c	19 Dec 2004 05:30:20 -0000	1.24
@@ -118,6 +118,7 @@
 	if (!conn->connected) {
 		if (!db_ldap_connect(conn)) {
 			request->callback(conn, request, NULL);
+			i_free(request);
 			return;
 		}
 	}
@@ -127,6 +128,7 @@
 		i_error("LDAP: ldap_search() failed (filter %s): %s",
 			filter, ldap_get_error(conn));
 		request->callback(conn, request, NULL);
+		i_free(request);
 		return;
 	}
 

Index: userdb-ldap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/userdb-ldap.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- userdb-ldap.c	6 Dec 2004 16:39:02 -0000	1.17
+++ userdb-ldap.c	19 Dec 2004 05:30:20 -0000	1.18
@@ -99,7 +99,6 @@
 		i_error("LDAP: ldap_search() failed: %s",
 			ldap_err2string(ret));
 		urequest->userdb_callback(NULL, request->context);
-		i_free(urequest);
 		return;
 	}
 
@@ -108,7 +107,6 @@
 		if (res != NULL)
 			i_error("LDAP: Authenticated user not found");
 		urequest->userdb_callback(NULL, request->context);
-		i_free(urequest);
 		return;
 	}
 
@@ -142,14 +140,12 @@
 			user.virtual_user);
 	} else {
 		urequest->userdb_callback(&user, request->context);
-		i_free(urequest);
 		t_pop();
 		return;
 	}
 
 	/* error */
 	urequest->userdb_callback(NULL, request->context);
-	i_free(urequest);
 	t_pop();
 }
 

Index: passdb-ldap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-ldap.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- passdb-ldap.c	6 Dec 2004 16:39:02 -0000	1.14
+++ passdb-ldap.c	19 Dec 2004 05:30:20 -0000	1.15
@@ -121,7 +121,6 @@
 			password, scheme,
 			ldap_request->callback.lookup_credentials,
 			auth_request);
-		i_free(request);
 		return;
 	}
 
@@ -129,7 +128,6 @@
 	if (password == NULL) {
 		ldap_request->callback.verify_plain(PASSDB_RESULT_USER_UNKNOWN,
 						    auth_request);
-		i_free(request);
 		return;
 	}
 
@@ -147,7 +145,6 @@
 	ldap_request->callback.verify_plain(ret > 0 ? PASSDB_RESULT_OK :
 					    PASSDB_RESULT_PASSWORD_MISMATCH,
 					    auth_request);
-	i_free(request);
 }
 
 static void ldap_lookup_pass(struct auth_request *auth_request,



More information about the dovecot-cvs mailing list