SASL: rate-limit after the 2nd failed attempt (m_sasl.c)

This commit is contained in:
Xenthys 2016-10-02 03:57:11 +02:00
parent c6d884e877
commit 46ef49c390
No known key found for this signature in database
GPG key ID: D68FF79CEE9A9B69

View file

@ -250,8 +250,12 @@ me_sasl(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{
if(*target_p->name)
{
target_p->localClient->sasl_failures++;
target_p->localClient->sasl_next_retry = rb_current_time() + (1 << MIN(target_p->localClient->sasl_failures + 5, 13));
/* Allow 2 tries before rate-limiting as some clients try EXTERNAL
* then PLAIN right after it if the auth failed, causing the client to be
* rate-limited immediately and not being able to login with SASL.
*/
if (target_p->localClient->sasl_failures++ > 0)
target_p->localClient->sasl_next_retry = rb_current_time() + (1 << MIN(target_p->localClient->sasl_failures + 5, 13));
}
else if(throttle_add((struct sockaddr*)&target_p->localClient->ip))
{