Skip to content
Snippets Groups Projects
Commit 68d9c326 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Truncate attempted user-name at '@' before comparing against name.can file

'@' is in the name.can by default and the mail server recognizes user@addr
formatted logins/attempts, so truncate at the '@' before comparing against
the name.can file to prevent false !TEMPORARY BAN (1 login attempts, ...
occurences.
parent 7c0ccd30
No related branches found
No related tags found
No related merge requests found
Pipeline #4977 passed
......@@ -3872,6 +3872,7 @@ ulong loginBanned(scfg_t* cfg, link_list_t* list, SOCKET sock, const char* host_
,struct login_attempt_settings settings, login_attempt_t* details)
{
char ip_addr[128];
char name[(LEN_ALIAS * 2) + 1];
list_node_t* node;
login_attempt_t* attempt;
BOOL result = FALSE;
......@@ -3912,8 +3913,10 @@ ulong loginBanned(scfg_t* cfg, link_list_t* list, SOCKET sock, const char* host_
if(node == NULL)
return 0;
attempt = node->data;
SAFECOPY(name, attempt->user);
truncstr(name, "@");
if(((settings.tempban_threshold && (attempt->count - attempt->dupes) >= settings.tempban_threshold)
|| trashcan(cfg, attempt->user, "name")) && now < (time32_t)(attempt->time + settings.tempban_duration)) {
|| trashcan(cfg, name, "name")) && now < (time32_t)(attempt->time + settings.tempban_duration)) {
if(details != NULL)
*details = *attempt;
return settings.tempban_duration - (now - attempt->time);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment