Unsychronized "/NAMES" on (some) networks #834

Open
opened 2026-10-05 04:47:23 +02:00 by adam · 9 comments
Owner

1.7.0 regression (works in 1.6.6)

ZNC seems to not properly sync NAMES output on some networks

Found configurations:

  • "protect" prefix is "!" PREFIX=(qaohv)*!@%+ (UnrealIRCd-4.0.15)
    • sample network: irc.bullet-irc.net

The /NAMES output will be empty if you reconnect to znc from a channel with a protect in it. A manual /NAMES #Channel resyncs the client.

refer to conversation at 2018-05-06 (~19:00 UTC) between Zarthus and Azo1 for full logs

1.7.0 regression (works in 1.6.6) ZNC seems to not properly sync NAMES output on some networks Found configurations: - "protect" prefix is "!" `PREFIX=(qaohv)*!@%+` (UnrealIRCd-4.0.15) - sample network: irc.bullet-irc.net The /NAMES output will be empty if you reconnect to znc from a channel with a protect in it. A manual `/NAMES #Channel` resyncs the client. refer to conversation at 2018-05-06 (~19:00 UTC) between Zarthus and Azo1 for full logs <!-- github-sync-id:320618536 -->
Author
Owner

Do you have an example channel with this?
When I tried mode +a, it said 499 ... :You're not a channel owner

Do you have an example channel with this? When I tried `mode +a`, it said `499 ... :You're not a channel owner` <!-- github-comment-id:388586227 -->
Author
Owner

No,

if the network doesn't give owner rights to new channel creations it might be hard to reproduce painlessly, but existing channels should work and probably exists in /list.

No, if the network doesn't give owner rights to new channel creations it might be hard to reproduce painlessly, but existing channels should work and probably exists in /list. <!-- github-comment-id:388589944 -->
Author
Owner

I can't reproduce this. Need full log of znc -D (except for passwords, of course)

I can't reproduce this. Need full log of `znc -D` (except for passwords, of course) <!-- github-comment-id:390039031 -->
Author
Owner

On behalf of fasm,

http://ix.io/1ld6

[2018-08-25 12:24:12.948204] (x/z) CLI -> ZNC [NAMES #test]
[2018-08-25 12:24:12.952524] (x/z) ZNC -> IRC [NAMES #test]
[2018-08-25 12:24:13.332085] (x/z) IRC -> ZNC [:networkname. 353 testuser @ #test :!ChanServ!chanserv@services. testuser!testuser@magical.unicorn ]
[2018-08-25 12:24:13.333004] (x/z) ZNC -> CLI [@time=2018-08-25T12:24:13.332Z :networkname. 353 testuser @ #test :ChanServ testuser]
[2018-08-25 12:24:13.333481] (x/z) IRC -> ZNC [:networkname. 366 testuser #test :End of /NAMES list.]
[2018-08-25 12:24:13.333918] (x/z) ZNC -> CLI [@time=2018-08-25T12:24:13.333Z :networkname. 366 testuser #test :End of /NAMES list.]

[2018-08-25 12:24:39.243965] (x/z) CLI -> ZNC [WHO #test]
[2018-08-25 12:24:39.245505] (x/z) ZNC -> IRC [WHO #test]
[2018-08-25 12:24:39.743944] (x/z) IRC -> ZNC [:networkname. 352 testuser #test chanserv services. services. ChanServ H! :0 ChanServ]
[2018-08-25 12:24:39.745416] (x/z) ZNC -> CLI [@time=2018-08-25T12:24:39.744Z :networkname. 352 testuser #test chanserv services. services. ChanServ H! :0 ChanServ]
[2018-08-25 12:24:39.746122] (x/z) IRC -> ZNC [:networkname. 352 testuser #test testuser magical.unicorn networkname. testuser H* :0 testuser]
[2018-08-25 12:24:39.746737] (x/z) ZNC -> CLI [@time=2018-08-25T12:24:39.746Z :networkname. 352 testuser #test testuser magical.unicorn networkname. testuser H* :0 testuser]
[2018-08-25 12:24:39.747190] (x/z) IRC -> ZNC [:networkname. 315 testuser #test :End of /WHO list.]
[2018-08-25 12:24:39.747881] (x/z) ZNC -> CLI [@time=2018-08-25T12:24:39.747Z :networkname. 315 testuser #test :End of /WHO list.]

Actual output in IRC client:
NAMES:
13:28 | Nicks #test: [ChanServ testuser]
13:28 | Channel #test: 2 nicks (0 ops, 0 halfops, 0 voices, 2 normals)

WHO:
13:24 | [#test] ChanServ (chanserv@services.) H! 0 (ChanServ)
13:24 | [#test] testuser (testuser@magical.unicorn) H* 0 (testuser)
13:24 | [#test] End of /WHO list.

Conversation between 12:00 - 13:00 (UTC), 2018-08-25

On behalf of `fasm`, http://ix.io/1ld6 ``` [2018-08-25 12:24:12.948204] (x/z) CLI -> ZNC [NAMES #test] [2018-08-25 12:24:12.952524] (x/z) ZNC -> IRC [NAMES #test] [2018-08-25 12:24:13.332085] (x/z) IRC -> ZNC [:networkname. 353 testuser @ #test :!ChanServ!chanserv@services. testuser!testuser@magical.unicorn ] [2018-08-25 12:24:13.333004] (x/z) ZNC -> CLI [@time=2018-08-25T12:24:13.332Z :networkname. 353 testuser @ #test :ChanServ testuser] [2018-08-25 12:24:13.333481] (x/z) IRC -> ZNC [:networkname. 366 testuser #test :End of /NAMES list.] [2018-08-25 12:24:13.333918] (x/z) ZNC -> CLI [@time=2018-08-25T12:24:13.333Z :networkname. 366 testuser #test :End of /NAMES list.] [2018-08-25 12:24:39.243965] (x/z) CLI -> ZNC [WHO #test] [2018-08-25 12:24:39.245505] (x/z) ZNC -> IRC [WHO #test] [2018-08-25 12:24:39.743944] (x/z) IRC -> ZNC [:networkname. 352 testuser #test chanserv services. services. ChanServ H! :0 ChanServ] [2018-08-25 12:24:39.745416] (x/z) ZNC -> CLI [@time=2018-08-25T12:24:39.744Z :networkname. 352 testuser #test chanserv services. services. ChanServ H! :0 ChanServ] [2018-08-25 12:24:39.746122] (x/z) IRC -> ZNC [:networkname. 352 testuser #test testuser magical.unicorn networkname. testuser H* :0 testuser] [2018-08-25 12:24:39.746737] (x/z) ZNC -> CLI [@time=2018-08-25T12:24:39.746Z :networkname. 352 testuser #test testuser magical.unicorn networkname. testuser H* :0 testuser] [2018-08-25 12:24:39.747190] (x/z) IRC -> ZNC [:networkname. 315 testuser #test :End of /WHO list.] [2018-08-25 12:24:39.747881] (x/z) ZNC -> CLI [@time=2018-08-25T12:24:39.747Z :networkname. 315 testuser #test :End of /WHO list.] Actual output in IRC client: NAMES: 13:28 | Nicks #test: [ChanServ testuser] 13:28 | Channel #test: 2 nicks (0 ops, 0 halfops, 0 voices, 2 normals) WHO: 13:24 | [#test] ChanServ (chanserv@services.) H! 0 (ChanServ) 13:24 | [#test] testuser (testuser@magical.unicorn) H* 0 (testuser) 13:24 | [#test] End of /WHO list. ``` Conversation between 12:00 - 13:00 (UTC), 2018-08-25 <!-- github-comment-id:415969418 -->
Author
Owner
:networkname. 353 testuser @ #test :!ChanServ!chanserv@services. testuser!testuser@magical.unicorn 
:networkname. 353 testuser @ #test :ChanServ testuser

So... ZNC turned !ChanServ!chanserv@services. into ChanServ here, but should have turned it into !ChanServ.

The code causing this is the handling of numeric 353 in Client::PutClient. If the IRC connection has UHNames, but the client connection has not, this does sNick = sNick.Token(0, false, "!"). Instead... this should be doing something else. No idea how to easily do this in a non-ugly way, but at least it should be relatively easy to write a test for this.
(CChan::AddNick does some semi-complex parsing that would work fine here, but that needs quite some code. All chars at the beginning for which CIRCSock::IsPermChar returns true must be preserved/ignored)

``` :networkname. 353 testuser @ #test :!ChanServ!chanserv@services. testuser!testuser@magical.unicorn :networkname. 353 testuser @ #test :ChanServ testuser ``` So... ZNC turned `!ChanServ!chanserv@services.` into `ChanServ` here, but should have turned it into `!ChanServ`. The code causing this is the handling of numeric `353` in `Client::PutClient`. If the IRC connection has UHNames, but the client connection has not, this does `sNick = sNick.Token(0, false, "!")`. Instead... this should be doing something else. No idea how to easily do this in a non-ugly way, but at least it should be relatively easy to write a test for this. (`CChan::AddNick` does some semi-complex parsing that would work fine here, but that needs quite some code. All chars at the beginning for which `CIRCSock::IsPermChar` returns `true` must be preserved/ignored) <!-- github-comment-id:416030061 -->
Author
Owner

Just updated my oldish ZNC installation to 1.7.4-rc1, and connecting to a inspircd3 with a couple of custom prefixes, this is still an issue.

Doing a /name #channel updates userlist to be correct, but userlist is not correct on initial connect.

Just updated my oldish ZNC installation to 1.7.4-rc1, and connecting to a inspircd3 with a couple of custom prefixes, this is still an issue. Doing a /name #channel updates userlist to be correct, but userlist is not correct on initial connect. <!-- github-comment-id:504210150 -->
Author
Owner

Just updated my oldish ZNC installation to 1.7.4-rc1, and connecting to a inspircd3 with a couple of custom prefixes, this is still an issue.

Doing a /name #channel updates userlist to be correct, but userlist is not correct on initial connect.

Can confirm (znc 1.7.5), as inspircd3.0 was released and more and more networks will switch over to it it might be worth looking into this again.

> Just updated my oldish ZNC installation to 1.7.4-rc1, and connecting to a inspircd3 with a couple of custom prefixes, this is still an issue. > > Doing a /name #channel updates userlist to be correct, but userlist is not correct on initial connect. Can confirm (znc 1.7.5), as inspircd3.0 was released and more and more networks will switch over to it it might be worth looking into this again. <!-- github-comment-id:538768361 -->
Author
Owner

Its still an issue here, at least, users are scripting their way out of it, but its not an ideal solution.

Its still an issue here, at least, users are scripting their way out of it, but its not an ideal solution. <!-- github-comment-id:538778688 -->
Author
Owner

Is this a solution?
src/Client.cpp
replace
sNick = sNick.Token(0, false, "!");
with
size_t uPrefixLen = 0;
while (uPrefixLen < sNick.size() &&
pIRCSock->IsPermChar(sNick[uPrefixLen])) {
++uPrefixLen;
}
CString sPrefix = sNick.substr(0, uPrefixLen);
CString sNickWithoutPrefix = sNick.substr(uPrefixLen);
sNick = sPrefix + sNickWithoutPrefix.Token(0, false, "!");

Is this a solution? src/Client.cpp replace sNick = sNick.Token(0, false, "!"); with size_t uPrefixLen = 0; while (uPrefixLen < sNick.size() && pIRCSock->IsPermChar(sNick[uPrefixLen])) { ++uPrefixLen; } CString sPrefix = sNick.substr(0, uPrefixLen); CString sNickWithoutPrefix = sNick.substr(uPrefixLen); sNick = sPrefix + sNickWithoutPrefix.Token(0, false, "!"); <!-- github-comment-id:4409470148 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#834