diff options
author | Luke Bratch <luke@bratch.co.uk> | 2019-09-07 13:09:24 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2019-09-07 13:09:24 +0100 |
commit | 202061c01eb3600a54f32b4e46327d6685fbd43d (patch) | |
tree | ff15ebddc355f152e7936c38114d1b58c8f7a4c7 | |
parent | e4d1706031540ae74ff104c44adeb735ee0bfcf4 (diff) |
Don't relay IRC operator WHOIS server responses and OPER up client requests to all clients.
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | message.c | 18 |
2 files changed, 14 insertions, 6 deletions
@@ -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. @@ -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) { |