fix(znc): reset cloned account identity to the new username #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/znc-clone-identity"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
New BNC accounts were showing the template account's IRC information instead of their own.
Cause
ZNC's
CloneUsercopies the template account wholesale — that includesNick,AltNick,IdentandRealName, not just the networks, servers, channels and modules we actually want.CreateBlockedonly followed up withSet Password,Set AdminandSet BindHost, so every account provisioned through the clone path connected to IRC presenting the template's identity.The bare
AddUserpath was never affected — ZNC derives those fields from the username itself there.Fix
Set
Nick,Altnick,IdentandRealNamefrom the username after cloning. Clone-only, to avoid emitting redundant commands on theAddUserpath.Tests
The clone branch had no test coverage at all, which is how this went unnoticed. Added:
TestCloneResetsIdentityToNewUser— the full expected control-command sequenceTestCloneLeavesNoTemplateIdentity— template name appears only inCloneUseritselfTestBareAddUserSkipsIdentityResets— no redundantSets on the bare pathTestCreateBlockedBindHostOverride— explicit bindHost wins over the configured defaultVerified the first test fails against the old code and passes against the new.
go build,go vetand the fullgo test ./...are clean.Notes
Setcommands are run against them. A backfill is a separate job.CloneUserclones networks too. If the template's networks set those explicitly they'd needSetNetworkas well — worth a look at the live template config.