]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
login: Always disconnect clients after 3 minutes if they haven't logged in.
authorTimo Sirainen <tss@iki.fi>
Mon, 8 Mar 2010 17:57:21 +0000 (19:57 +0200)
committerTimo Sirainen <tss@iki.fi>
Mon, 8 Mar 2010 17:57:21 +0000 (19:57 +0200)
--HG--
branch : HEAD

src/login-common/client-common.c
src/login-common/client-common.h

index da8800825c748dd2f62325a0f2133b62ad0c988a..2cce52e73a1525f9dfccc3d491399192bbf646b3 100644 (file)
@@ -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;
        }
 }
index 85521dfd1318b072d4e9d1187990e63de64235d6..4b47855c1a6b8fa49531906b4a3b1148023e7283 100644 (file)
@@ -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;