1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-02 09:26:39 +02:00

Prevent +b ~inherit:#chan in #chan. This didn't cause any problem but

doesn't make any sense either, so just reject it. Reported by alice.
This commit is contained in:
Bram Matthys
2024-09-14 19:07:15 +02:00
parent 4504adf149
commit ca7e4ab966
+21 -8
View File
@@ -267,18 +267,31 @@ int extban_inherit_is_ok(BanContext *b)
if (!valid_channelname(retbuf))
{
sendnotice(b->client, "ExtBan ~inherit expects a channel name");
sendnotice(b->client, "ExtBan ~inherit with invalid channel name");
return 0;
}
if ((b->what == MODE_ADD) && b->channel && exceeds_inherit_ban_count(b))
/* For MODE_DEL we are not strict, since you should be able to delete
* existing entries, even if they are wrong). For MODE_ADD we are stricter.
*/
if ((b->what == MODE_ADD) && b->channel)
{
sendnotice(b->client, "Your ExtBan ~inherit:%s was not accepted because "
"this channel already contains the maximum "
"amount of ~inherit entries (%d).",
b->banstr,
maximum_ban_inherit_limit(b->ban_type));
return 0;
if (find_channel(retbuf) == b->channel)
{
sendnotice(b->client, "You cannot add an ~inherit extban that "
"refers to the same channel, this makes no sense.");
return 0;
}
if (exceeds_inherit_ban_count(b))
{
sendnotice(b->client, "Your ExtBan ~inherit:%s was not accepted because "
"this channel already contains the maximum "
"amount of ~inherit entries (%d).",
b->banstr,
maximum_ban_inherit_limit(b->ban_type));
return 0;
}
}
return 1;