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. --- message.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'message.c') 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