[dovecot-cvs] dovecot/src/pop3-login client-authenticate.c, 1.45, 1.46 client.c, 1.45, 1.46 pop3-proxy.c, 1.9, 1.10

cras at dovecot.org cras at dovecot.org
Sat Jan 14 20:48:22 EET 2006


Update of /var/lib/cvs/dovecot/src/pop3-login
In directory talvi:/tmp/cvs-serv16037/pop3-login

Modified Files:
	client-authenticate.c client.c pop3-proxy.c 
Log Message:
deinit, unref, destroy, close, free, etc. functions now take a pointer to
their data pointer, and set it to NULL. This makes double-frees less likely
to cause security holes.



Index: client-authenticate.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/pop3-login/client-authenticate.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- client-authenticate.c	13 Jan 2006 20:26:49 -0000	1.45
+++ client-authenticate.c	14 Jan 2006 18:48:17 -0000	1.46
@@ -138,7 +138,7 @@
 
 	/* get back to normal client input. */
 	if (client->io != NULL)
-		io_remove(client->io);
+		io_remove(&client->io);
 	client->io = io_add(client->common.fd, IO_READ,
 			    client_input, client);
 	return TRUE;
@@ -172,7 +172,7 @@
 
 		/* get back to normal client input. */
 		if (client->io != NULL)
-			io_remove(client->io);
+			io_remove(&client->io);
 		client->io = io_add(client->common.fd, IO_READ,
 				    client_input, client);
 		break;
@@ -242,7 +242,7 @@
 
 	/* following input data will go to authentication */
 	if (client->io != NULL)
-		io_remove(client->io);
+		io_remove(&client->io);
 	client->io = io_add(client->common.fd, IO_READ,
 			    client_auth_input, client);
 	return TRUE;
@@ -297,10 +297,8 @@
 		return TRUE;
 
 	/* don't read any input from client until login is finished */
-	if (client->io != NULL) {
-		io_remove(client->io);
-		client->io = NULL;
-	}
+	if (client->io != NULL)
+		io_remove(&client->io);
 	return TRUE;
 }
 
@@ -357,9 +355,7 @@
 		return TRUE;
 
 	/* don't read any input from client until login is finished */
-	if (client->io != NULL) {
-		io_remove(client->io);
-		client->io = NULL;
-	}
+	if (client->io != NULL)
+		io_remove(&client->io);
 	return TRUE;
 }

Index: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/pop3-login/client.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- client.c	13 Jan 2006 20:26:49 -0000	1.45
+++ client.c	14 Jan 2006 18:48:17 -0000	1.46
@@ -87,8 +87,8 @@
 
 	client->common.fd = fd_ssl;
 
-	i_stream_unref(client->input);
-	o_stream_unref(client->output);
+	i_stream_unref(&client->input);
+	o_stream_unref(&client->output);
 
 	client_open_streams(client, fd_ssl);
 	client->io = io_add(client->common.fd, IO_READ, client_input, client);
@@ -123,10 +123,8 @@
 
 	/* remove input handler, SSL proxy gives us a new fd. we also have to
 	   remove it in case we have to wait for buffer to be flushed */
-	if (client->io != NULL) {
-		io_remove(client->io);
-		client->io = NULL;
-	}
+	if (client->io != NULL)
+		io_remove(&client->io);
 
 	client_send_line(client, "+OK Begin TLS negotiation now.");
 
@@ -366,10 +364,8 @@
 	if (client->common.master_tag != 0)
 		master_request_abort(&client->common);
 
-	if (client->io != NULL) {
-		io_remove(client->io);
-		client->io = NULL;
-	}
+	if (client->io != NULL)
+		io_remove(&client->io);
 
 	if (client->common.fd != -1) {
 		net_disconnect(client->common.fd);
@@ -414,9 +410,9 @@
 		return TRUE;
 
 	if (client->input != NULL)
-		i_stream_unref(client->input);
+		i_stream_unref(&client->input);
 	if (client->output != NULL)
-		o_stream_unref(client->output);
+		o_stream_unref(&client->output);
 
 	i_free(client->last_user);
 	i_free(client->apop_challenge);
@@ -515,5 +511,5 @@
 	clients_destroy_all();
 	hash_destroy(clients);
 
-	timeout_remove(to_idle);
+	timeout_remove(&to_idle);
 }

Index: pop3-proxy.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/pop3-login/pop3-proxy.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- pop3-proxy.c	9 Jan 2005 19:56:00 -0000	1.9
+++ pop3-proxy.c	14 Jan 2006 18:48:17 -0000	1.10
@@ -153,10 +153,7 @@
 	client->proxy_password = i_strdup(password);
 
 	/* disable input until authentication is finished */
-	if (client->io != NULL) {
-		io_remove(client->io);
-		client->io = NULL;
-	}
-
+	if (client->io != NULL)
+		io_remove(&client->io);
 	return 0;
 }



More information about the dovecot-cvs mailing list