[dovecot-cvs] dovecot/src/master auth-process.c, 1.86, 1.87 dict-process.c, 1.2, 1.3 log.c, 1.5, 1.6 login-process.c, 1.68, 1.69 main.c, 1.69, 1.70 ssl-init.c, 1.13, 1.14

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


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

Modified Files:
	auth-process.c dict-process.c log.c login-process.c main.c 
	ssl-init.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: auth-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/auth-process.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- auth-process.c	13 Jan 2006 20:26:40 -0000	1.86
+++ auth-process.c	14 Jan 2006 18:48:02 -0000	1.87
@@ -347,7 +347,7 @@
 
 	if (close(p->worker_listen_fd) < 0)
 		i_error("close(worker_listen) failed: %m");
-	io_remove(p->worker_io);
+	io_remove(&p->worker_io);
 
 	iter = hash_iterate_init(p->requests);
 	while (hash_iterate(iter, &key, &value))
@@ -355,9 +355,9 @@
 	hash_iterate_deinit(iter);
 	hash_destroy(p->requests);
 
-	i_stream_unref(p->input);
-	o_stream_unref(p->output);
-	io_remove(p->io);
+	i_stream_unref(&p->input);
+	o_stream_unref(&p->output);
+	io_remove(&p->io);
 	if (close(p->fd) < 0)
 		i_error("close(auth) failed: %m");
 	i_free(p);
@@ -738,6 +738,6 @@
 
 void auth_processes_deinit(void)
 {
-	timeout_remove(to);
+	timeout_remove(&to);
 	auth_processes_destroy_all();
 }

Index: dict-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/dict-process.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dict-process.c	14 Jan 2006 14:01:42 -0000	1.2
+++ dict-process.c	14 Jan 2006 18:48:02 -0000	1.3
@@ -142,8 +142,7 @@
 		i_error("close(dict) failed: %m");
 	process->fd = -1;
 
-	io_remove(process->io);
-	process->io = NULL;
+	io_remove(&process->io);
 }
 
 void dict_process_init(void)

Index: log.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/log.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- log.c	13 Jan 2006 20:26:40 -0000	1.5
+++ log.c	14 Jan 2006 18:48:02 -0000	1.6
@@ -57,10 +57,8 @@
 		       FALSE);
 	}
 
-	if (log_io->io != NULL) {
-		io_remove(log_io->io);
-		log_io->io = NULL;
-	}
+	if (log_io->io != NULL)
+		io_remove(&log_io->io);
 
 	if (to == NULL)
 		to = timeout_add(1000, log_throttle_timeout, NULL);
@@ -72,10 +70,8 @@
 	if (log_io->io != NULL)
 		return;
 
-	if (--throttle_count == 0 && to != NULL) {
-		timeout_remove(to);
-		to = NULL;
-	}
+	if (--throttle_count == 0 && to != NULL)
+		timeout_remove(&to);
 	log_io->io = io_add(i_stream_get_fd(log_io->stream),
 			    IO_READ, log_read, log_io);
 }
@@ -218,10 +214,10 @@
 		log_io->next->prev = log_io->prev;
 
 	if (log_io->io != NULL)
-		io_remove(log_io->io);
+		io_remove(&log_io->io);
 	else
 		throttle_count--;
-	i_stream_unref(log_io->stream);
+	i_stream_unref(&log_io->stream);
 	i_free(log_io->prefix);
 	i_free(log_io);
 }
@@ -264,5 +260,5 @@
 	}
 
 	if (to != NULL)
-		timeout_remove(to);
+		timeout_remove(&to);
 }

Index: login-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/login-process.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- login-process.c	13 Jan 2006 20:26:40 -0000	1.68
+++ login-process.c	14 Jan 2006 18:48:02 -0000	1.69
@@ -361,7 +361,7 @@
 		p->group->listening_processes--;
 
 	o_stream_close(p->output);
-	io_remove(p->io);
+	io_remove(&p->io);
 	if (close(p->fd) < 0)
 		i_error("close(login) failed: %m");
 
@@ -382,7 +382,7 @@
 	if (--p->refcount > 0)
 		return;
 
-	o_stream_unref(p->output);
+	o_stream_unref(&p->output);
 	i_free(p);
 }
 
@@ -718,9 +718,9 @@
 void login_processes_deinit(void)
 {
 	if (to != NULL)
-		timeout_remove(to);
+		timeout_remove(&to);
 	if (io_listen != NULL)
-		io_remove(io_listen);
+		io_remove(&io_listen);
 
         login_processes_destroy_all();
 	hash_destroy(processes);

Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/main.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- main.c	13 Jan 2006 20:26:40 -0000	1.69
+++ main.c	14 Jan 2006 18:48:02 -0000	1.70
@@ -569,7 +569,7 @@
 	dict_process_deinit();
 	ssl_deinit();
 
-	timeout_remove(to);
+	timeout_remove(&to);
 
 	if (close(null_fd) < 0)
 		i_error("close(null_fd) failed: %m");
@@ -776,7 +776,7 @@
 	main_deinit();
 
 	master_settings_deinit();
-	io_loop_destroy(ioloop);
+	io_loop_destroy(&ioloop);
 	lib_deinit();
 
         return 0;

Index: ssl-init.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/ssl-init.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- ssl-init.c	13 Jan 2006 20:26:40 -0000	1.13
+++ ssl-init.c	14 Jan 2006 18:48:02 -0000	1.14
@@ -123,7 +123,7 @@
 
 void ssl_deinit(void)
 {
-	timeout_remove(to);
+	timeout_remove(&to);
 }
 
 #else



More information about the dovecot-cvs mailing list