Skip to content

Fix ghost users in auditorium (+A) channels - #276

Open
oldmagic wants to merge 1 commit into
DALnet:masterfrom
oldmagic:auditorium-ghosts
Open

oldmagic wants to merge 1 commit into
DALnet:masterfrom
oldmagic:auditorium-ghosts

Conversation

@oldmagic

Copy link
Copy Markdown

In a +A (auditorium) channel, members without op, halfop or voice are hidden from each other. Ops, halfops and voiced users see everyone. Two cases give a client a hidden member without ever sending it that member's NICK, QUIT or PART. The member then stays in the client's nick list forever as a "ghost".

Bug 1: IRC operators who are in the channel

m_names() exempts opers from the +A check (!IsAnOper(sptr)), and so does m_who(). But the JOIN/NICK/QUIT/PART fan-out in send.c (sendto_common_channels(), send_quit_to_common_channels(), send_part_to_common_channels(), sendto_channel_butserv_noopvoice()) does not. An oper without channel status who joins a +A channel gets every hidden member in the NAMES reply on join. When those members later rename or quit, the oper hears nothing.

Fix: the oper exemption in m_names() now applies only when the oper is not a member of the channel. Opers can still look up who is in a +A channel from outside it, since that builds no nick list. An oper who is a member sees the same names they will get events for. m_who() is unchanged: WHO is a lookup and doesn't feed a client's nick list.

I chose this over sending membership events to opers. That alternative goes wrong again whenever a user opers up or down while already in the channel.

Bug 2: members who lose op/halfop/voice

When a local user gets +v/+h/+o in a +A channel, set_mode() resends their nick list (fake KICK, JOIN, NAMES) so they see the hidden members. The reverse never happens. After losing their last status, the user keeps every hidden member in their client, but is no longer sent their NICK/QUIT/PART.

Fix: when a local user goes from having any of +o/+h/+v to having none, send them a PART for each member who is now hidden from them. I used PARTs rather than the KICK-and-rejoin used for +v, because some clients show kicks or auto-rejoin. Losing just one of several statuses (for example -v on someone who is still @) sends nothing.

Repro

Needs a +A channel. Only servers can set +A, so set it from services.

Bug 1

  1. Op joins #test; services set +A.
  2. Hidden joins #test (no status).
  3. Oper opers up and joins #test. Their NAMES reply includes Hidden.
  4. Hidden changes nick, then quits. Oper gets neither message, and Hidden stays in Oper's nick list. A fresh /NAMES no longer lists them.

Bug 2

  1. Op joins #test; services set +A; Op voices Was.
  2. Hidden joins and Was sees the JOIN.
  3. Op sets -v Was. Was gets no PART or nick list refresh for Hidden.
  4. Hidden quits. Was never hears about it.

Testing

I tested on two linked servers built from master (fc3d398), plus a test U-lined server that sets +A. A script checks exactly which users see each JOIN/NICK/QUIT/PART: a local op, a remote op, a voiced user, an oper with no channel status, and plain local and remote members. It covers:

  • NICK, QUIT and banned QUIT (sent as PART) of hidden members, both local and remote
  • NICK and QUIT of voiced members
  • a hidden member who also shares a normal channel with the user (message arrives exactly once)
  • the two ghost cases above
  • an oper outside the channel can still see hidden members in NAMES
  • an op who loses only +v gets no PARTs and still sees hidden members quit
Build Result
master (fc3d398) 57 pass, 2 fail (exactly the two ghost cases)
master + this patch 59 pass, 0 fail

channel.c compiles without warnings, before and after the patch.

🤖 Generated with Claude Code

Two cases left members of a +A channel with hidden users in their
nick list who never go away, because the client is never told when
those users change nick or leave:

- m_names() listed hidden members to IRC operators who are in the
  channel, but JOIN/NICK/QUIT/PART of hidden members are not sent to
  them. Now the oper exemption only applies when the oper is not a
  member of the channel.

- A local user who loses their last of +o/+h/+v keeps the plain
  members they saw while they had status, but is no longer sent their
  NICK/QUIT/PART. Send them a PART for each hidden member, the reverse
  of the nicklist resend that already happens on +v.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant