Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5364:8e2d0438d4ac HEAD
Call auth_client_reconnect() when the last client has disconnected to make
sure all the memory used by the auth connections get cleared.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 18 Mar 2007 16:08:26 +0200 |
parents | 235433e7d9c2 |
children | 35f18edd5f17 |
files | src/lib-auth/auth-client.c src/lib-auth/auth-client.h src/login-common/main.c |
diffstat | 3 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-auth/auth-client.c Sun Mar 18 05:09:51 2007 +0200 +++ b/src/lib-auth/auth-client.c Sun Mar 18 16:08:26 2007 +0200 @@ -50,6 +50,19 @@ i_free(client); } +void auth_client_reconnect(struct auth_client *client) +{ + struct auth_server_connection *next; + + while (client->connections != NULL) { + next = client->connections->next; + auth_server_connection_destroy(&client->connections, FALSE); + client->connections = next; + } + + auth_client_connect_missing_servers(client); +} + const struct auth_mech_desc * auth_client_get_available_mechs(struct auth_client *client, unsigned int *mech_count)
--- a/src/lib-auth/auth-client.h Sun Mar 18 05:09:51 2007 +0200 +++ b/src/lib-auth/auth-client.h Sun Mar 18 16:08:26 2007 +0200 @@ -44,6 +44,9 @@ struct auth_client *auth_client_new(unsigned int client_pid); void auth_client_free(struct auth_client **client); +/* Destroy all connections and reconnect. */ +void auth_client_reconnect(struct auth_client *client); + bool auth_client_is_connected(struct auth_client *client); void auth_client_set_connect_notify(struct auth_client *client, auth_connect_notify_callback_t *callback,
--- a/src/login-common/main.c Sun Mar 18 05:09:51 2007 +0200 +++ b/src/login-common/main.c Sun Mar 18 16:08:26 2007 +0200 @@ -51,6 +51,13 @@ dovecot-auth, since it's not needed anymore. */ if (auth_client != NULL) auth_client_free(&auth_client); + } else if (clients_get_count() == 0) { + /* make sure we clear all the memory used by the + authentication connections. also this makes sure that if + this connection's authentication was finished but the master + login wasn't, the next connection won't be able to log in + as this user by finishing the master login. */ + auth_client_reconnect(auth_client); } }