From 4544c4b56eae07e9da7ed0b4b0329b2989494f0b Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Sun, 9 Apr 2023 03:17:18 +0200 Subject: Fix ban list request handling - support both "MODE #channel b" and "MODE #channel +b". --- TODO | 9 ++------- message.c | 6 ++++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/TODO b/TODO index c29c3ba..c65634f 100644 --- a/TODO +++ b/TODO @@ -24,13 +24,6 @@ Do connectcommands happen on reconnect? Are "no such nick/channel" messages as shown in clients correct compared to non-(bla)bouncer clients? -Support ban list when requesting /mode #channel +b (commands 367 and 368 at least) - ensure max ban list length is supported. example: -:irc.tghost.co.uk 367 l_bratch #foo *!foo@bar.bz l_bratch 1642588731 -:irc.tghost.co.uk 367 l_bratch #foo *!*bbuser@*.bratch.co.uk l_bratch 1642588681 -:irc.tghost.co.uk 368 l_bratch #foo :End of Channel Ban List -Or if there are no bans then just 368: -:irc.tghost.co.uk 368 l_bratch #foo :End of Channel Ban List - Other IRC clients log stuff like "Mar 31 16:58:15 * #foobar :No topic is set." - can/should we? Git version in code. @@ -47,4 +40,6 @@ Debug log ("checking client socket out of ") gets busy after fdmax ge BLABOUNCER/stdin functions to add: - List connected/authenticated clients +KICK not handled. + Crash when requesting 30 hour replay. diff --git a/message.c b/message.c index 5458b72..7067776 100644 --- a/message.c +++ b/message.c @@ -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) { -- cgit v1.2.3