Skip to content

Fix victim lookup after op mode binds - #1923

Merged
vanosg merged 2 commits into
eggheads:developfrom
tkimball83:fix-mode-victim-host-refresh
Aug 1, 2026
Merged

vanosg merged 2 commits into
eggheads:developfrom
tkimball83:fix-mode-victim-host-refresh

Conversation

@tkimball83

Copy link
Copy Markdown
Contributor

Found by: tkimball83
Patch by: tkimball83
Fixes:

One-line summary:

Initialize the mode target's nick/userhost before refreshing its user flags after op and halfop Tcl mode binds.

Additional description (if needed):

got_op() and got_halfop() pass the local s buffer to modebind_refresh() without initializing it. modebind_refresh() then uses that buffer as the host argument to lookup_user_record() while refreshing the target's flag record.

As a result, the refreshed victim flags can belong to no user or the wrong user. With +bitch, a recognized bot that has global op can then be treated as unauthorized and deopped immediately after receiving op.

Populate s from the channel member before invoking the Tcl mode bind, matching the existing pattern in got_deop() and the voice-mode handling.

Test cases demonstrating functionality (if applicable):

  • Reproduced with two instances of the official eggdrop:1.10.1 Linux image in a ten-bot network using +bitch.
  • Before testing, both rebuilt bots' current IRC masks were confirmed saved exactly once in every bot's userfile, and the channel was allowed to finish NAMES/WHO synchronization.
  • After each controlled deop, the target was correctly reopped, but a stock bot issued an unsolicited deop of the recognized target about one second later. This repeated throughout the test.
  • Repeated the same post-synchronization mode churn with a 1.10.1 image containing only these two added lines: 20 controlled deop/reop cycles completed without an unsolicited deop.
  • Current develop compiles successfully on macOS arm64 with ./configure --disable-tls && make config && make -j4.

@michaelortmann

Copy link
Copy Markdown
Member

Thank you alot for this PR.

The bug is a regression introduced in eggdrop 1.10.0 via #1585.

Can you please take a look at got_dehalfop() also? Looks like that function also needs fixing.

@tkimball83

Copy link
Copy Markdown
Contributor Author

Updated the PR to fix got_dehalfop() as suggested. It now initializes the victim host string before calling modebind_refresh(), and I removed the unused s1 buffer/assignment from that function as dead code.

The updated change passes the debug build and the full integration suite: 159 passed, 0 failed.

@michaelortmann

Copy link
Copy Markdown
Member

LGTM

@thommey thommey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice find and fix, thank you!

@vanosg vanosg added this to the v1.10.2 milestone Aug 1, 2026
@vanosg
vanosg merged commit 3e2e287 into eggheads:develop Aug 1, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants