From f808e56ffbfbfe7e02498ec59b4e81e6146d597c Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sun, 22 Nov 2020 16:03:42 +0100 Subject: [PATCH] Fix counting clients twice. Reported by Le_Coyote. --- src/modules/nick.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/modules/nick.c b/src/modules/nick.c index 2feaf1bf9..0e460db1d 100644 --- a/src/modules/nick.c +++ b/src/modules/nick.c @@ -866,6 +866,12 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char /* Check G/Z lines before shuns -- kill before quite -- codemastr */ if (find_tkline_match(client, 0)) { + if (!IsDead(client) && client->local->class) + { + /* Fix client count bug, in case that it was a hold such as via authprompt */ + client->local->class->clients--; + client->local->class = NULL; + } ircstats.is_ref++; return 0; } @@ -892,7 +898,17 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char { i = (*(h->func.intfunc))(client); if (i == HOOK_DENY) + { + if (!IsDead(client) && client->local->class) + { + /* Fix client count bug, in case that + * the HOOK_DENY was only meant temporarily. + */ + client->local->class->clients--; + client->local->class = NULL; + } return 0; + } if (i == HOOK_ALLOW) break; }