Skip to content

fix(plugin): avoid BanClient before the player entity exists (#1579) - #1580

Merged
rumblefrog merged 1 commit into
mainfrom
fix/1579-verifyban-client-entity
Sep 28, 2026
Merged

rumblefrog merged 1 commit into
mainfrom
fix/1579-verifyban-client-entity

Conversation

@rumblefrog

@rumblefrog rumblefrog commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Fixes #1579.

Summary

  • VerifyBan runs from the threaded ban check started in OnClientAuthorized, which can land before OnClientPutInServer. SourceMod's BanClient() resolves the client with ReferenceToIndex(), which returns -1 while the client's edict has no game entity yet. That raised Client index -1 is invalid, and the banned player was never kicked.
  • fix(plugin): use native auth IDs for engine bans #1572 introduced the BanClient call. The previous banid + KickClient path did not depend on the entity.
  • Replace it with entity-independent natives that mirror BanClient's BANFLAG_AUTO:
    • Ban the engine auth string via BanIdentity, which keeps Synergy's native Steam3 form from fix(plugin): use native auth IDs for engine bans #1572, then KickClient.
    • On LAN servers or if the auth lookup fails, KickClientEx and then ban the IP. This matches BanClient's kick-then-addip order.
  • The other BanClient call, in PrepareBan, is already gated on IsClientInGame(target), so it is unaffected.

VerifyBan runs from OnClientAuthorized, which can land before
OnClientPutInServer. BanClient() resolves the client through
ReferenceToIndex(), which returns -1 while the edict has no entity, so
SourceMod threw "Client index -1 is invalid" and the banned player was
never kicked. #1572 introduced the BanClient call; the previous
banid + KickClient path did not depend on the entity.

Mirror BanClient's BANFLAG_AUTO with entity-independent natives: ban
the engine auth string via BanIdentity (keeps Synergy's native Steam3
form) and KickClient; when the auth lookup fails or the server is LAN,
KickClientEx then ban the IP, matching BanClient's kick-then-addip
order.
@rumblefrog
rumblefrog requested a review from a team September 28, 2026 20:50
@rumblefrog
rumblefrog merged commit a418884 into main Sep 28, 2026
1 check passed
@rumblefrog
rumblefrog deleted the fix/1579-verifyban-client-entity branch September 28, 2026 20:52
Rushaway added a commit to srcdslab/sourcebans-pp that referenced this pull request Sep 30, 2026
VerifyBan runs from OnClientAuthorized, which can land before
OnClientPutInServer. BanClient() resolves the client through
ReferenceToIndex(), which returns -1 while the edict has no entity, so
SourceMod threw "Client index -1 is invalid" and the banned player was
never kicked.

Ban the engine auth string with BanIdentity (keeps Synergy's native
Steam3 form) and KickClient; when the auth lookup fails or the server
is LAN, KickClientEx then ban the IP, matching BanClient's
kick-then-addip order.

Port of upstream sbpp#1580 (a418884).
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.

sbpp_main.smx: "Client index -1 is invalid" in BanClient called from VerifyBan (line 1727)

1 participant