[dovecot-cvs] dovecot/src/login-common login-proxy.c,1.11,1.12

tss at dovecot.org tss at dovecot.org
Sat Oct 14 00:11:09 UTC 2006


Update of /var/lib/cvs/dovecot/src/login-common
In directory talvi:/tmp/cvs-serv6724/login-common

Modified Files:
	login-proxy.c 
Log Message:
Reference counter fixing for client while it's being used in login proxy.
Fixes crashes.



Index: login-proxy.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/login-common/login-proxy.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- login-proxy.c	6 Aug 2006 20:05:35 -0000	1.11
+++ login-proxy.c	13 Oct 2006 23:11:04 -0000	1.12
@@ -189,6 +189,7 @@
 
 	if (proxy->destroying)
 		return;
+	proxy->destroying = TRUE;
 
 	if (proxy->client_fd != -1) {
 		/* detached proxy */
@@ -205,7 +206,9 @@
 			o_stream_destroy(&proxy->client_output);
 		net_disconnect(proxy->client_fd);
 	} else {
-		proxy->destroying = TRUE;
+		i_assert(proxy->client_io == NULL);
+		i_assert(proxy->client_output == NULL);
+
 		proxy->callback(NULL, NULL, proxy->context);
 	}
 
@@ -235,6 +238,9 @@
 	const unsigned char *data;
 	size_t size;
 
+	i_assert(proxy->client_fd == -1);
+	i_assert(proxy->server_output != NULL);
+
 	proxy->client_fd = i_stream_get_fd(client_input);
 	proxy->client_output = client_output;
 
@@ -254,7 +260,10 @@
 	proxy->client_io =
 		io_add(proxy->client_fd, IO_READ, proxy_client_input, proxy);
 	o_stream_set_flush_callback(proxy->server_output, server_output, proxy);
-	i_stream_unref(&proxy->server_input);
+	i_stream_destroy(&proxy->server_input);
+
+	proxy->callback = NULL;
+	proxy->context = NULL;
 
 	if (login_proxies == NULL) {
 		login_proxies = hash_create(default_pool, default_pool,



More information about the dovecot-cvs mailing list