[dovecot-cvs] dovecot/src/login-common login-proxy.c, 1.10.2.1, 1.10.2.2

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


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

Modified Files:
      Tag: branch_1_0
	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.10.2.1
retrieving revision 1.10.2.2
diff -u -d -r1.10.2.1 -r1.10.2.2
--- login-proxy.c	6 Aug 2006 20:05:24 -0000	1.10.2.1
+++ login-proxy.c	13 Oct 2006 23:11:03 -0000	1.10.2.2
@@ -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