[dovecot-cvs] dovecot/src/login-common ssl-proxy-openssl.c, 1.23, 1.24

cras at dovecot.org cras at dovecot.org
Fri Jul 9 14:45:03 EEST 2004


Update of /home/cvs/dovecot/src/login-common
In directory talvi:/tmp/cvs-serv30383/login-common

Modified Files:
	ssl-proxy-openssl.c 
Log Message:
Refcounting fixes. Unexpectedly destroyed SSL connection could have left
looping for a long time.



Index: ssl-proxy-openssl.c
===================================================================
RCS file: /home/cvs/dovecot/src/login-common/ssl-proxy-openssl.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- ssl-proxy-openssl.c	17 May 2004 01:32:17 -0000	1.23
+++ ssl-proxy-openssl.c	9 Jul 2004 11:45:01 -0000	1.24
@@ -368,6 +368,8 @@
 
 void ssl_proxy_free(struct ssl_proxy *proxy)
 {
+	if (!proxy->destroyed)
+		ssl_proxy_destroy(proxy);
 	ssl_proxy_unref(proxy);
 }
 
@@ -377,6 +379,19 @@
 		return TRUE;
 	i_assert(proxy->refcount == 0);
 
+	SSL_free(proxy->ssl);
+	i_free(proxy);
+
+	main_unref();
+	return FALSE;
+}
+
+static void ssl_proxy_destroy(struct ssl_proxy *proxy)
+{
+	if (proxy->destroyed)
+		return;
+	proxy->destroyed = TRUE;
+
 	hash_remove(ssl_proxies, proxy);
 
 	(void)net_disconnect(proxy->fd_ssl);
@@ -391,19 +406,7 @@
 	if (proxy->io_plain_write != NULL)
 		io_remove(proxy->io_plain_write);
 
-	SSL_free(proxy->ssl);
-	i_free(proxy);
-
-	main_unref();
-	return FALSE;
-}
-
-static void ssl_proxy_destroy(struct ssl_proxy *proxy)
-{
-	if (!proxy->destroyed) {
-		proxy->destroyed = TRUE;
-		ssl_proxy_unref(proxy);
-	}
+	ssl_proxy_unref(proxy);
 }
 
 static RSA *ssl_gen_rsa_key(SSL *ssl __attr_unused__,



More information about the dovecot-cvs mailing list