Skip to content

Commit

Permalink
Fix +b ~forward not taking into account +e (ban exemptions).
Browse files Browse the repository at this point in the history
  • Loading branch information
syzop committed May 19, 2024
1 parent 229b3a7 commit b07f02f
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/modules/chanmodes/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,30 @@ int link_pre_localjoin_cb(Client *client, Channel *channel, const char *key)
b->banstr = banmask;
if (ban_check_mask(b))
{
safe_free(b);
return link_doforward(client, channel, banchan, LINKTYPE_BAN);
/* Forward ban matched, now check for +e */
Ban *ex = NULL;
for (ex = channel->exlist; ex; ex = ex->next)
{
b->banstr = ex->banstr;
if (ban_check_mask(b))
{
/* except matched, break inner loop */
break;
}
}
if (ex == NULL)
{
/* A ~forward ban matched, go for it.. */
safe_free(b);
return link_doforward(client, channel, banchan, LINKTYPE_BAN);
} else {
/* Break the outer loop as well: the user is exempt,
* so it makes no sense to check other bans anymore.
* no "safe_free(b);" here because that is taken
* care of further down.
*/
break;
}
}
}

Expand Down

1 comment on commit b07f02f

@devnull-hub-lab
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Please sign in to comment.