Skip to content

Commit

Permalink
Fix ircv3_extjwt generating tokens for private/secret channels.
Browse files Browse the repository at this point in the history
  • Loading branch information
SadieCat committed Apr 13, 2024
1 parent 7c5c9db commit 2cae8c9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions 3/m_ircv3_extjwt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,13 @@ class CommandExtJWT CXX11_FINAL

// Is the user expecting a user token or a channel token?
Channel* chan = NULL;
Membership* memb = NULL;
if (parameters[0] != "*")
{
// Chec that the target channel actually exists.
chan = ServerInstance->FindChan(parameters[0]);
if (!chan || chan->IsModeSet(privatemode) || chan->IsModeSet(secretmode))
memb = chan ? chan->GetUser(user) : NULL;
if (!chan || (!memb && (chan->IsModeSet(privatemode) || chan->IsModeSet(secretmode))))
{
// The target channel does not exist.
user->WriteNumeric(Numerics::NoSuchChannel(parameters[0]));
Expand Down Expand Up @@ -294,7 +296,6 @@ class CommandExtJWT CXX11_FINAL
writer.String(chan->name);

writer.Key("joined");
Membership* memb = chan->GetUser(user);
writer.Uint64(memb ? ext.get(memb) : 0);

writer.Key("cmodes");
Expand Down

0 comments on commit 2cae8c9

Please sign in to comment.