/* Copyright (c) 2009-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "net.h"
#include "crc32.h"
#include "master-service.h"
#include "anvil-client.h"
#include "auth-request.h"
#include "auth-penalty.h"
#include <stdio.h>
/* We don't want IPv6 hosts being able to flood our penalty
tracking with tons of different IPs. */
struct auth_penalty_request {
};
struct auth_penalty {
};
{
else {
"PENALTY-SET-EXPIRE-SECS\t%u", AUTH_PENALTY_TIMEOUT));
}
return penalty;
}
{
}
{
for (i = 0; i < penalty; i++)
secs *= 2;
}
{
unsigned int penalty = 0;
unsigned long last_penalty = 0;
/* internal failure. */
/* we probably didn't have permissions to reconnect
back to anvil. need to restart ourself. */
}
} else {
/* time moved backwards? */
}
/* update penalty. */
while (penalty > 0) {
break;
drop_penalty--;
penalty--;
}
}
}
static const char *
{
if (IPADDR_IS_V6(&ip)) {
}
return net_ip2addr(&ip);
}
struct auth_request *auth_request,
{
const char *ident;
ident = auth_penalty_get_ident(auth_request);
callback(0, auth_request);
return;
}
T_BEGIN {
t_strdup_printf("PENALTY-GET\t%s", ident),
} T_END;
}
static unsigned int
{
auth_request->user);
}
{
const char *ident;
ident = auth_penalty_get_ident(auth_request);
return;
if (value > AUTH_PENALTY_MAX_PENALTY) {
/* even if the actual value doesn't change, the last_change
timestamp does. */
}
T_BEGIN {
const char *cmd;
unsigned int checksum;
} T_END;
}