[dovecot-cvs] dovecot/src/imap-login client-authenticate.c, 1.37, 1.38 client.c, 1.46, 1.47 imap-proxy.c, 1.6, 1.7

cras at dovecot.org cras at dovecot.org
Sat Jan 14 20:47:24 EET 2006


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

Modified Files:
	client-authenticate.c client.c imap-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/imap-login/client-authenticate.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- client-authenticate.c	13 Jan 2006 20:26:00 -0000	1.37
+++ client-authenticate.c	14 Jan 2006 18:47:22 -0000	1.38
@@ -168,7 +168,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;
 }
@@ -201,7 +201,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;
@@ -254,7 +254,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 0;
@@ -308,10 +308,8 @@
 		return 1;
 
 	/* 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 0;
 }

Index: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap-login/client.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- client.c	13 Jan 2006 20:26:00 -0000	1.46
+++ client.c	14 Jan 2006 18:47:22 -0000	1.47
@@ -129,9 +129,9 @@
 	client_set_title(client);
 
 	client->common.fd = fd_ssl;
-	i_stream_unref(client->input);
-	o_stream_unref(client->output);
-	imap_parser_destroy(client->parser);
+	i_stream_unref(&client->input);
+	o_stream_unref(&client->output);
+	imap_parser_destroy(&client->parser);
 
 	/* CRLF is lost from buffer when streams are reopened. */
 	client->skip_line = FALSE;
@@ -169,10 +169,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_tagline(client, "OK Begin TLS negotiation now.");
 
@@ -477,10 +475,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);
@@ -526,12 +522,12 @@
 	if (--client->refcount > 0)
 		return TRUE;
 
-	imap_parser_destroy(client->parser);
+	imap_parser_destroy(&client->parser);
 
 	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->common.virtual_user);
 	i_free(client->common.auth_mech_name);
@@ -637,5 +633,5 @@
 	clients_destroy_all();
 	hash_destroy(clients);
 
-	timeout_remove(to_idle);
+	timeout_remove(&to_idle);
 }

Index: imap-proxy.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap-login/imap-proxy.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- imap-proxy.c	7 Jan 2005 16:46:29 -0000	1.6
+++ imap-proxy.c	14 Jan 2006 18:47:22 -0000	1.7
@@ -139,10 +139,8 @@
 	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