Skip to content

Commit

Permalink
Fix ~account:* matching both logged in and logged out users (so quite…
Browse files Browse the repository at this point in the history
… useless).

This bug exists since 5.2.1 already, so i guess the functionality is
not used much ;). Makes sense, since for simple ~account:* you have +R already,
so it is only useful in stacked bans such as +e ~nickchange:~account:*

We now have a test case so that this bug won't "ever" reoccur.

Reported by rafaelgrether in https://bugs.unrealircd.org/view.php?id=6211
  • Loading branch information
syzop committed Jan 9, 2023
1 parent 5897ce3 commit c5d8bc5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/modules/extbans/account.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ const char *extban_account_conv_param(BanContext *b, Extban *extban)
int extban_account_is_banned(BanContext *b)
{
/* ~a:0 is special and matches all unauthenticated users */
if (!strcmp(b->banstr, "0") && !IsLoggedIn(b->client))
return 1;
if (!strcmp(b->banstr, "0"))
return IsLoggedIn(b->client) ? 0 : 1;

/* ~a:* matches all authenticated users
* (Yes this special code is needed because account
* is 0 or * for unauthenticated users)
*/
if (!strcmp(b->banstr, "*") && IsLoggedIn(b->client))
return 1;
if (!strcmp(b->banstr, "*"))
return IsLoggedIn(b->client) ? 1 : 0;

if (b->client->user && match_simple(b->banstr, b->client->user->account))
return 1;
Expand Down

1 comment on commit c5d8bc5

@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.