1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-12 17:14:46 +02:00

Forward SPAMREPORT command to the server that the target user is on.

That is, if a nick is specified. For an IP address obviously we won't.

This is needed later for when unrealircd api SPAMREPORT becomes
available, since remote servers don't have all the info.

Side-effect is that, if you only configured one server to do
spamreporting, that won't work anymore. But that is an unusual
case anyway, and now unsupported :D.
This commit is contained in:
Bram Matthys
2023-11-12 17:29:35 +01:00
parent d2ccba80c5
commit e84e2b30d2
+32 -9
View File
@@ -103,6 +103,12 @@ int tkl_config_test_spamreport(ConfigFile *cf, ConfigEntry *ce, int type, int *e
config_error("%s:%i: spamreport block has no name, should be like: spamfilter <name> { }",
ce->file->filename, ce->line_number);
errors++;
} else
if (!strcasecmp(ce->value, "unrealircd"))
{
config_error("%s:%i: spamreport block cannot be named 'unrealircd', is a reserved name.",
ce->file->filename, ce->line_number);
errors++;
}
for (cep = ce->items; cep; cep = cep->next)
@@ -492,6 +498,32 @@ CMD_FUNC(cmd_spamreport)
ip = parv[1];
if ((target = find_user(parv[1], NULL)))
{
if (!MyUser(target))
{
/* Forward it to other server */
if (parc > 2)
{
sendto_one(target, NULL, ":%s SPAMREPORT %s %s",
client->id, parv[1], parv[2]);
} else {
sendto_one(target, NULL, ":%s SPAMREPORT %s",
client->id, parv[1]);
}
return;
}
/* It's for us */
if (target->ip)
ip = target->ip;
}
if (!is_valid_ip(ip))
{
sendnotice(client, "Not a valid nick/IP: %s", ip);
return;
}
if ((parc > 2) && !BadPtr(parv[2]))
{
to = find_spamreport_block(parv[2]);
@@ -502,15 +534,6 @@ CMD_FUNC(cmd_spamreport)
}
}
if ((target = find_user(parv[1], NULL)) && target->ip)
ip = target->ip;
if (!is_valid_ip(ip))
{
sendnotice(client, "Not a valid IP: %s", ip);
return;
}
if (!((n = spamreport(target, ip, NULL, to ? to->name : NULL))))
sendnotice(client, "Could not report spam. No spamreport { } blocks configured, or all filtered out/exempt.");
else