1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-04 03:03:13 +02:00

In the FLOOD_BLOCKED log message, add the target of the flood.

Suggested by ComputerTech in https://bugs.unrealircd.org/view.php?id=6148
This commit is contained in:
Bram Matthys
2023-03-17 09:56:56 +01:00
parent 16d6c0efd6
commit 5e57228dfb
2 changed files with 11 additions and 2 deletions
+8 -2
View File
@@ -259,7 +259,10 @@ int targetfloodprot_can_send_to_channel(Client *client, Channel *channel, Member
if (flood->cnt[what] >= channelcfg->cnt[what])
{
/* Flood detected */
flood_limit_exceeded_log(client, "target-flood-channel");
unreal_log(ULOG_INFO, "flood", "FLOOD_BLOCKED", client,
"Flood blocked ($flood_type) from $client.details [$client.ip] to $channel",
log_data_string("flood_type", "target-flood-channel"),
log_data_channel("channel", channel));
snprintf(errbuf, sizeof(errbuf), "Channel is being flooded. Message not delivered.");
*errmsg = errbuf;
return HOOK_DENY;
@@ -306,7 +309,10 @@ int targetfloodprot_can_send_to_user(Client *client, Client *target, const char
if (flood->cnt[what] >= privatecfg->cnt[what])
{
/* Flood detected */
flood_limit_exceeded_log(client, "target-flood-user");
unreal_log(ULOG_INFO, "flood", "FLOOD_BLOCKED", client,
"Flood blocked ($flood_type) from $client.details [$client.ip] to $target",
log_data_string("flood_type", "target-flood-user"),
log_data_client("target", target));
snprintf(errbuf, sizeof(errbuf), "User is being flooded. Message not delivered.");
*errmsg = errbuf;
return HOOK_DENY;
+3
View File
@@ -829,6 +829,9 @@ void flood_limit_exceeded_log(Client *client, const char *floodname)
{
char buf[1024];
// NOTE: If you ever change this format, there are a few more
// direct unreal_log() calls with "FLOOD_BLOCKED" in the file
// src/modules/targetfloodprot.c, so update those as well.
unreal_log(ULOG_INFO, "flood", "FLOOD_BLOCKED", client,
"Flood blocked ($flood_type) from $client.details [$client.ip]",
log_data_string("flood_type", floodname));