From: Timo Sirainen Date: Mon, 8 Mar 2010 17:57:21 +0000 (+0200) Subject: login: Always disconnect clients after 3 minutes if they haven't logged in. X-Git-Tag: 2.0.beta4~101 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5a9e240ebf8d0daaf029973973b52e415148070b;p=thirdparty%2Fdovecot%2Fcore.git login: Always disconnect clients after 3 minutes if they haven't logged in. --HG-- branch : HEAD --- diff --git a/src/login-common/client-common.c b/src/login-common/client-common.c index da8800825c..2cce52e73a 100644 --- a/src/login-common/client-common.c +++ b/src/login-common/client-common.c @@ -71,8 +71,8 @@ client_create(int fd, bool ssl, pool_t pool, DLLIST_PREPEND(&clients, client); clients_count++; - client->to_idle_disconnect = - timeout_add(CLIENT_LOGIN_IDLE_TIMEOUT_MSECS, + client->to_disconnect = + timeout_add(CLIENT_LOGIN_TIMEOUT_MSECS, client_idle_disconnect_timeout, client); client_open_streams(client); @@ -125,8 +125,8 @@ void client_destroy(struct client *client, const char *reason) if (client->io != NULL) io_remove(&client->io); - if (client->to_idle_disconnect != NULL) - timeout_remove(&client->to_idle_disconnect); + if (client->to_disconnect != NULL) + timeout_remove(&client->to_disconnect); if (client->to_auth_waiting != NULL) timeout_remove(&client->to_auth_waiting); if (client->auth_response != NULL) @@ -563,7 +563,6 @@ bool client_read(struct client *client) return TRUE; default: /* something was read */ - timeout_reset(client->to_idle_disconnect); return TRUE; } } diff --git a/src/login-common/client-common.h b/src/login-common/client-common.h index 85521dfd13..4b47855c1a 100644 --- a/src/login-common/client-common.h +++ b/src/login-common/client-common.h @@ -15,8 +15,9 @@ SASL authentication gives the largest output. */ #define LOGIN_MAX_OUTBUF_SIZE 4096 -/* Disconnect client after idling this many milliseconds */ -#define CLIENT_LOGIN_IDLE_TIMEOUT_MSECS (3*60*1000) +/* Disconnect client after this many milliseconds if it hasn't managed + to log in yet. */ +#define CLIENT_LOGIN_TIMEOUT_MSECS (3*60*1000) #define AUTH_SERVER_WAITING_MSG \ "Waiting for authentication process to respond.." @@ -86,7 +87,7 @@ struct client { struct ostream *output; struct io *io; struct timeout *to_auth_waiting; - struct timeout *to_idle_disconnect; + struct timeout *to_disconnect; unsigned char *master_data_prefix; unsigned int master_data_prefix_len;