Mercurial > dovecot > original-hg > dovecot-1.2
changeset 1230:e6d2b8c78519 HEAD
Keep list of the SSL proxies, so they're deinitialized properly if we have
to kill them.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 23 Feb 2003 12:45:46 +0200 |
parents | 88e025c0d1c6 |
children | 6352baabd8a1 |
files | src/login-common/main.c src/login-common/ssl-proxy-openssl.c |
diffstat | 2 files changed, 20 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/login-common/main.c Sun Feb 23 12:43:38 2003 +0200 +++ b/src/login-common/main.c Sun Feb 23 12:45:46 2003 +0200 @@ -212,12 +212,12 @@ if (io_listen != NULL) io_remove(io_listen); if (io_ssl_listen != NULL) io_remove(io_ssl_listen); + ssl_proxy_deinit(); + clients_deinit(); master_deinit(); auth_connection_deinit(); - ssl_proxy_deinit(); - closelog(); }
--- a/src/login-common/ssl-proxy-openssl.c Sun Feb 23 12:43:38 2003 +0200 +++ b/src/login-common/ssl-proxy-openssl.c Sun Feb 23 12:45:46 2003 +0200 @@ -37,6 +37,7 @@ }; static SSL_CTX *ssl_ctx; +static struct hash_table *ssl_proxies; static void plain_read(struct ssl_proxy *proxy); static void plain_write(struct ssl_proxy *proxy); @@ -317,6 +318,7 @@ } main_ref(); + hash_insert(ssl_proxies, proxy, proxy); return sfd[1]; } @@ -325,6 +327,8 @@ if (--proxy->refcount > 0) return TRUE; + hash_remove(ssl_proxies, proxy); + SSL_free(proxy->ssl); (void)net_disconnect(proxy->fd_ssl); @@ -375,13 +379,25 @@ keyfile, ssl_last_error()); } + ssl_proxies = hash_create(default_pool, default_pool, 0, NULL, NULL); ssl_initialized = TRUE; } +static void ssl_proxy_destroy_hash(void *key __attr_unused__, void *value, + void *context __attr_unused__) +{ + ssl_proxy_destroy(value); +} + void ssl_proxy_deinit(void) { - if (ssl_initialized) - SSL_CTX_free(ssl_ctx); + if (!ssl_initialized) + return; + + SSL_CTX_free(ssl_ctx); + + hash_foreach(ssl_proxies, ssl_proxy_destroy_hash, NULL); + hash_destroy(ssl_proxies); } #endif