From 202061c01eb3600a54f32b4e46327d6685fbd43d Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Sat, 7 Sep 2019 13:09:24 +0100 Subject: Don't relay IRC operator WHOIS server responses and OPER up client requests to all clients. --- TODO | 2 -- message.c | 18 ++++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 0714ace..a736bf1 100644 --- a/TODO +++ b/TODO @@ -6,8 +6,6 @@ All the TODOs sprinkled throughout the code! (I think) replay log can cause non-existent user to appear in channel (e.g. ~19:00 on 12/08/2019 for me) -Do server operator messages and commands work? - (I vaguely recall) some unwanted stuff (channel ban info?) was relayed to another client upon a client connecting. PM replay chat in a channel (or perhaps a random channel?) e.g. replay on 06/09/2019 at 17:05 from 13:49 in #insomnia - maybe a client thing. diff --git a/message.c b/message.c index 0373ef3..b815bec 100644 --- a/message.c +++ b/message.c @@ -526,16 +526,19 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int } // Server 307 (RPL_SUSERHOST), 311 (RPL_WHOISUSER), 312 (RPL_WHOISSERVER), 313 (RPL_WHOISOPERATOR), 317 (RPL_WHOISIDLE), - // 319 (RPL_WHOISCHANNELS), 320 (RPL_WHOISSPECIAL), 671 (RPL_WHOISSECURE), or 318 (RPL_ENDOFWHOIS) received? + // 319 (RPL_WHOISCHANNELS), 320 (RPL_WHOISSPECIAL), 378 (RPL_WHOISHOST), 379 (RPL_WHOISMODES), 671 (RPL_WHOISSECURE), + // or 318 (RPL_ENDOFWHOIS) received? // Send to any clients who requested a WHOIS. if (strncmp(tokens[1], "307", strlen(tokens[1])) == 0 || strncmp(tokens[1], "311", strlen(tokens[1])) == 0 || strncmp(tokens[1], "312", strlen(tokens[1])) == 0 || strncmp(tokens[1], "313", strlen(tokens[1])) == 0 || strncmp(tokens[1], "317", strlen(tokens[1])) == 0 || strncmp(tokens[1], "319", strlen(tokens[1])) == 0 || - strncmp(tokens[1], "320", strlen(tokens[1])) == 0 || strncmp(tokens[1], "671", strlen(tokens[1])) == 0 || + strncmp(tokens[1], "320", strlen(tokens[1])) == 0 || strncmp(tokens[1], "378", strlen(tokens[1])) == 0 || + strncmp(tokens[1], "379", strlen(tokens[1])) == 0 || strncmp(tokens[1], "671", strlen(tokens[1])) == 0 || strncmp(tokens[1], "318", strlen(tokens[1])) == 0) { debugprint(DEBUG_FULL, "Server 307 RPL_SUSERHOST, 311 RPL_WHOISUSER, 312 RPL_WHOISSERVER, 313 (RPL_WHOISOPERATOR), 317 RPL_WHOISIDLE, " - "319 RPL_WHOISCHANNELS, 320 (RPL_WHOISSPECIAL), 671 (RPL_WHOISSECURE), or 318 RPL_ENDOFWHOIS found and it is: " - "%s with length %zd! Sending to clients who are pending one of these.\n", tokens[1], strlen(tokens[1])); + "319 RPL_WHOISCHANNELS, 320 (RPL_WHOISSPECIAL), 378 RPL_WHOISHOST, 379 (RPL_WHOISMODES), 671 (RPL_WHOISSECURE), " + "or 318 RPL_ENDOFWHOIS found and it is: %s with length %zd! Sending to clients who are pending one of these.\n", tokens[1], + strlen(tokens[1])); // Relay to all pending clients for (int i = 0; i < MAXCLIENTS; i++) { @@ -1158,6 +1161,13 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int } } + // Client OPER received, send straight on to server + if (strncasecmp(tokens[0], "OPER", strlen(tokens[0])) == 0) { + debugprint(DEBUG_FULL, "Client OPER found and it is: %s with length %zd! Sending to server..\n", tokens[0], strlen(tokens[0])); + sendtoserver(server_ssl, str, strlen(str), sourcefd, clients, settings); + return 1; + } + // Custom BLABOUNCER command received // Case insensitive comparisons here since clients won't be recognising and uppercasing these commands if (strncasecmp(tokens[0], "BLABOUNCER", strlen(tokens[0])) == 0) { -- cgit v1.2.3