]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
login: Reset idle timeout only when input is actually read from client.
authorTimo Sirainen <tss@iki.fi>
Fri, 19 Dec 2008 07:46:46 +0000 (09:46 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 19 Dec 2008 07:46:46 +0000 (09:46 +0200)
This prevents client from just sending lots of failed authentication
attempts and then doing nothing for hours.

--HG--
branch : HEAD

src/imap-login/client-authenticate.c
src/imap-login/client.c
src/pop3-login/client-authenticate.c
src/pop3-login/client.c

index 11f95ebb866a8a9b8781532313f5286ed442ffef..dbbd40d83e064878ae2771ac6943e58f9dcef7f8 100644 (file)
@@ -115,7 +115,6 @@ static void client_auth_failed(struct imap_client *client, bool nodelay)
                AUTH_FAILURE_DELAY_INCREASE_MSECS;
        if (delay_msecs > CLIENT_LOGIN_IDLE_TIMEOUT_MSECS)
                delay_msecs = CLIENT_LOGIN_IDLE_TIMEOUT_MSECS - 1000;
-       timeout_reset(client->to_idle_disconnect);
 
        i_assert(client->to_authfail_delay == NULL);
        client->to_authfail_delay =
index d1e2ae77004ed83cad9f453d012893de3cfc66c1..eb6950586fbcac40a327ac2909d6878905236c5f 100644 (file)
@@ -387,16 +387,18 @@ bool client_read(struct imap_client *client)
                /* disconnected */
                client_destroy(client, "Disconnected");
                return FALSE;
+       case 0:
+               /* nothing new read */
+               return TRUE;
        default:
                /* something was read */
+               timeout_reset(client->to_idle_disconnect);
                return TRUE;
        }
 }
 
 void client_input(struct imap_client *client)
 {
-       timeout_reset(client->to_idle_disconnect);
-
        if (!client_read(client))
                return;
 
index 4f2e10efde6a3a40266230d18005012fb7d30aba..019182e2c0a8bf0a9bfd8d75c01466711569529b 100644 (file)
@@ -115,7 +115,6 @@ static void client_auth_failed(struct pop3_client *client, bool nodelay)
                AUTH_FAILURE_DELAY_INCREASE_MSECS;
        if (delay_msecs > CLIENT_LOGIN_IDLE_TIMEOUT_MSECS)
                delay_msecs = CLIENT_LOGIN_IDLE_TIMEOUT_MSECS - 1000;
-       timeout_reset(client->to_idle_disconnect);
 
        i_assert(client->to_authfail_delay == NULL);
        client->to_authfail_delay =
index 594b645183b68179ac7cc7c8d89b561414edfada..efe23ae3fb3e616d86127c86247db55ecd83e3e7 100644 (file)
@@ -179,8 +179,12 @@ bool client_read(struct pop3_client *client)
                /* disconnected */
                client_destroy(client, "Disconnected");
                return FALSE;
+       case 0:
+               /* nothing new read */
+               return TRUE;
        default:
                /* something was read */
+               timeout_reset(client->to_idle_disconnect);
                return TRUE;
        }
 }
@@ -191,7 +195,6 @@ void client_input(struct pop3_client *client)
 
        i_assert(!client->common.authenticating);
 
-       timeout_reset(client->to_idle_disconnect);
        if (!client_read(client))
                return;