diff options
author | Luke Bratch <luke@bratch.co.uk> | 2023-04-09 03:17:18 +0200 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2023-04-09 03:17:18 +0200 |
commit | 4544c4b56eae07e9da7ed0b4b0329b2989494f0b (patch) | |
tree | 32128af212b3350314ddf428269447017000b411 /message.c | |
parent | ee74977dae90d8cb037a757f7561ceee27819784 (diff) |
Fix ban list request handling - support both "MODE #channel b" and "MODE #channel +b".
Diffstat (limited to 'message.c')
-rw-r--r-- | message.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -602,6 +602,7 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int sendtoclient(clients[i].fd, str, clients, settings, 0); // And clear the pending flag if it's 368 (RPL_ENDOFBANLIST) if (strncmp(tokens[1], "368", strlen(tokens[1])) == 0) { + debugprint(DEBUG_FULL, "368 (RPL_ENDOFBANLIST) received, setting pendingban = 0 on client fd %d.\n", clients[i].fd); clients[i].pendingban = 0; } } @@ -1206,8 +1207,9 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int if (strncasecmp(tokens[0], "MODE", strlen(tokens[0])) == 0) { debugprint(DEBUG_FULL, "Client MODE found and it is: %s with length %zd! Analysing...\n", tokens[0], strlen(tokens[0])); // Is it a ban MODE request (MODE #channel b)? - // TODO - Can something else beginning with "b" be in this position? Need a length comparison? - if (counter >= 3 && strncmp(tokens[2], "b", strlen("b")) == 0) { + if (counter >= 3 && (((strlen(tokens[2]) == strlen("b")) && strncmp(tokens[2], "b", strlen("b")) == 0) + || ((strlen(tokens[2]) == strlen("+b")) && strncmp(tokens[2], "+b", strlen("+b")) == 0)) + ) { debugprint(DEBUG_FULL, "Ban MODE request received, marking as pending.\n"); clients[clientindex].pendingban = 1; } else if (counter == 2) { |