ZNC sends actual NICK too late to IRC client #1010

Open
opened 2026-10-05 04:58:20 +02:00 by adam · 4 comments
Owner

When connecting to IRC with irssi via ZNC, the NICK is sent too late. irssi isn't aware of the actual nick and uses the wrong one to set mode +i.

See raw log from irssi, NICK nope is what is configured in irssi, NICK cxl is the actual nick on that IRC server, and irssi sends MODE <nick> +i:

<< CAP LS
<< PASS ***/libera:irssi
<< NICK nope
<< USER nope nope bnc.example.org :nope
>> :irc.znc.in CAP unknown-nick LS :batch cap-notify echo-message multi-prefix server-time userhost-in-names znc.in/batch znc.in/self-message znc.in/server-time-iso
<< CAP REQ :multi-prefix
>> :irc.znc.in CAP nope ACK :multi-prefix
<< CAP END
>> :tantalum.libera.chat 001 nope :Welcome to the Libera.Chat Internet Relay Chat Network cxl
<< MODE nope +i
>> :tantalum.libera.chat 002 nope :Your host is tantalum.libera.chat[93.158.237.2/6697], running version solanum-1.0-dev
>> :tantalum.libera.chat 003 nope :This server was created Mon Nov 22 2021 at 18:12:28 UTC
>> :tantalum.libera.chat 004 nope tantalum.libera.chat solanum-1.0-dev DGQRSZaghilopsuwz CFILMPQSTbcefgijklmnopqrstuvz bkloveqjfI
>> :tantalum.libera.chat 005 nope WHOX MONITOR=100 SAFELIST ELIST=CMNTU ETRACE FNC CALLERID=g KNOCK CHANTYPES=# EXCEPTS INVEX CHANMODES=eIbq,k,flj,CFLMPQSTcgimnprstuz :are supported by this server
>> :tantalum.libera.chat 005 nope CHANLIMIT=#:250 PREFIX=(ov)@+ MAXLIST=bqeI:100 MODES=4 NETWORK=Libera.Chat STATUSMSG=@+ CASEMAPPING=rfc1459 NICKLEN=16 MAXNICKLEN=16 CHANNELLEN=50 TOPICLEN=390 DEAF=D :are supported by this server
>> :tantalum.libera.chat 005 nope TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:4,NOTICE:4,ACCEPT:,MONITOR: EXTBAN=$,ajrxz :are supported by this server
>> :tantalum.libera.chat 251 nope :There are 67 users and 42759 invisible on 28 servers
>> :tantalum.libera.chat 252 nope 41 :IRC Operators online
>> :tantalum.libera.chat 254 nope 21929 :channels formed
>> :tantalum.libera.chat 255 nope :I have 655 clients and 1 servers
>> :tantalum.libera.chat 265 nope 655 4545 :Current local users 655, max 4545
>> :tantalum.libera.chat 266 nope 42826 53550 :Current global users 42826, max 53550
>> :tantalum.libera.chat 250 nope :Highest connection count: 4546 (4545 clients) (368870 connections received)
>> :nope!~hey_its_m@user/cxl NICK :cxl
>> :tantalum.libera.chat 375 cxl :- tantalum.libera.chat Message of the Day -
>> :tantalum.libera.chat 372 cxl :- This server provided by Hyperfilter (https://hyperfilter.com)
>> :tantalum.libera.chat 372 cxl :-
>> :tantalum.libera.chat 372 cxl :-
>> :tantalum.libera.chat 372 cxl :- Welcome to Libera Chat, the IRC network for
>> :tantalum.libera.chat 372 cxl :- free & open-source software and peer directed projects.
>> :tantalum.libera.chat 372 cxl :-
>> :tantalum.libera.chat 372 cxl :- Use of Libera Chat is governed by our network policies.
>> :tantalum.libera.chat 372 cxl :-
>> :tantalum.libera.chat 372 cxl :- To reduce network abuses we perform open proxy checks
>> :tantalum.libera.chat 372 cxl :- on hosts at connection time.
>> :tantalum.libera.chat 372 cxl :-
>> :tantalum.libera.chat 372 cxl :- Please visit us in #libera for questions and support.
>> :tantalum.libera.chat 372 cxl :-
>> :tantalum.libera.chat 372 cxl :- Website and documentation:  https://libera.chat
>> :tantalum.libera.chat 372 cxl :- Webchat:                    https://web.libera.chat
>> :tantalum.libera.chat 372 cxl :- Network policies:           https://libera.chat/policies
>> :tantalum.libera.chat 372 cxl :- Email:                      support@libera.chat
>> :tantalum.libera.chat 376 cxl :End of /MOTD command.
>> :cxl!~hey_its_m@user/cxl MODE cxl :+Ziw
When connecting to IRC with irssi via ZNC, the `NICK` is sent too late. irssi isn't aware of the actual nick and uses the wrong one to set mode `+i`. See raw log from irssi, `NICK nope` is what is configured in irssi, `NICK cxl` is the actual nick on that IRC server, and irssi sends `MODE <nick> +i`: ``` << CAP LS << PASS ***/libera:irssi << NICK nope << USER nope nope bnc.example.org :nope >> :irc.znc.in CAP unknown-nick LS :batch cap-notify echo-message multi-prefix server-time userhost-in-names znc.in/batch znc.in/self-message znc.in/server-time-iso << CAP REQ :multi-prefix >> :irc.znc.in CAP nope ACK :multi-prefix << CAP END >> :tantalum.libera.chat 001 nope :Welcome to the Libera.Chat Internet Relay Chat Network cxl << MODE nope +i >> :tantalum.libera.chat 002 nope :Your host is tantalum.libera.chat[93.158.237.2/6697], running version solanum-1.0-dev >> :tantalum.libera.chat 003 nope :This server was created Mon Nov 22 2021 at 18:12:28 UTC >> :tantalum.libera.chat 004 nope tantalum.libera.chat solanum-1.0-dev DGQRSZaghilopsuwz CFILMPQSTbcefgijklmnopqrstuvz bkloveqjfI >> :tantalum.libera.chat 005 nope WHOX MONITOR=100 SAFELIST ELIST=CMNTU ETRACE FNC CALLERID=g KNOCK CHANTYPES=# EXCEPTS INVEX CHANMODES=eIbq,k,flj,CFLMPQSTcgimnprstuz :are supported by this server >> :tantalum.libera.chat 005 nope CHANLIMIT=#:250 PREFIX=(ov)@+ MAXLIST=bqeI:100 MODES=4 NETWORK=Libera.Chat STATUSMSG=@+ CASEMAPPING=rfc1459 NICKLEN=16 MAXNICKLEN=16 CHANNELLEN=50 TOPICLEN=390 DEAF=D :are supported by this server >> :tantalum.libera.chat 005 nope TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:4,NOTICE:4,ACCEPT:,MONITOR: EXTBAN=$,ajrxz :are supported by this server >> :tantalum.libera.chat 251 nope :There are 67 users and 42759 invisible on 28 servers >> :tantalum.libera.chat 252 nope 41 :IRC Operators online >> :tantalum.libera.chat 254 nope 21929 :channels formed >> :tantalum.libera.chat 255 nope :I have 655 clients and 1 servers >> :tantalum.libera.chat 265 nope 655 4545 :Current local users 655, max 4545 >> :tantalum.libera.chat 266 nope 42826 53550 :Current global users 42826, max 53550 >> :tantalum.libera.chat 250 nope :Highest connection count: 4546 (4545 clients) (368870 connections received) >> :nope!~hey_its_m@user/cxl NICK :cxl >> :tantalum.libera.chat 375 cxl :- tantalum.libera.chat Message of the Day - >> :tantalum.libera.chat 372 cxl :- This server provided by Hyperfilter (https://hyperfilter.com) >> :tantalum.libera.chat 372 cxl :- >> :tantalum.libera.chat 372 cxl :- >> :tantalum.libera.chat 372 cxl :- Welcome to Libera Chat, the IRC network for >> :tantalum.libera.chat 372 cxl :- free & open-source software and peer directed projects. >> :tantalum.libera.chat 372 cxl :- >> :tantalum.libera.chat 372 cxl :- Use of Libera Chat is governed by our network policies. >> :tantalum.libera.chat 372 cxl :- >> :tantalum.libera.chat 372 cxl :- To reduce network abuses we perform open proxy checks >> :tantalum.libera.chat 372 cxl :- on hosts at connection time. >> :tantalum.libera.chat 372 cxl :- >> :tantalum.libera.chat 372 cxl :- Please visit us in #libera for questions and support. >> :tantalum.libera.chat 372 cxl :- >> :tantalum.libera.chat 372 cxl :- Website and documentation: https://libera.chat >> :tantalum.libera.chat 372 cxl :- Webchat: https://web.libera.chat >> :tantalum.libera.chat 372 cxl :- Network policies: https://libera.chat/policies >> :tantalum.libera.chat 372 cxl :- Email: support@libera.chat >> :tantalum.libera.chat 376 cxl :End of /MOTD command. >> :cxl!~hey_its_m@user/cxl MODE cxl :+Ziw ``` <!-- github-sync-id:1198560588 -->
Author
Owner

is sent too late.

Uhm... when would be "not too late"?

This is only a guess, but I bet that from ZNC's point of view, it sends the following all at once, even before irssi sends the MODE:

>> :tantalum.libera.chat 001 nope :Welcome to the Libera.Chat Internet Relay Chat Network cxl
>> :tantalum.libera.chat 002 nope :Your host is tantalum.libera.chat[93.158.237.2/6697], running version solanum-1.0-dev
>> :tantalum.libera.chat 003 nope :This server was created Mon Nov 22 2021 at 18:12:28 UTC
>> :tantalum.libera.chat 004 nope tantalum.libera.chat solanum-1.0-dev DGQRSZaghilopsuwz CFILMPQSTbcefgijklmnopqrstuvz bkloveqjfI
>> :tantalum.libera.chat 005 nope WHOX MONITOR=100 SAFELIST ELIST=CMNTU ETRACE FNC CALLERID=g KNOCK CHANTYPES=# EXCEPTS INVEX CHANMODES=eIbq,k,flj,CFLMPQSTcgimnprstuz :are supported by this server
>> :tantalum.libera.chat 005 nope CHANLIMIT=#:250 PREFIX=(ov)@+ MAXLIST=bqeI:100 MODES=4 NETWORK=Libera.Chat STATUSMSG=@+ CASEMAPPING=rfc1459 NICKLEN=16 MAXNICKLEN=16 CHANNELLEN=50 TOPICLEN=390 DEAF=D :are supported by this server
>> :tantalum.libera.chat 005 nope TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:4,NOTICE:4,ACCEPT:,MONITOR: EXTBAN=$,ajrxz :are supported by this server
>> :tantalum.libera.chat 251 nope :There are 67 users and 42759 invisible on 28 servers
>> :tantalum.libera.chat 252 nope 41 :IRC Operators online
>> :tantalum.libera.chat 254 nope 21929 :channels formed
>> :tantalum.libera.chat 255 nope :I have 655 clients and 1 servers
>> :tantalum.libera.chat 265 nope 655 4545 :Current local users 655, max 4545
>> :tantalum.libera.chat 266 nope 42826 53550 :Current global users 42826, max 53550
>> :tantalum.libera.chat 250 nope :Highest connection count: 4546 (4545 clients) (368870 connections received)
>> :nope!~hey_its_m@user/cxl NICK :cxl
>> :tantalum.libera.chat 375 cxl :- tantalum.libera.chat Message of the Day -
>> :tantalum.libera.chat 372 cxl :- This server provided by Hyperfilter (https://hyperfilter.com)
>> :tantalum.libera.chat 372 cxl :-
>> :tantalum.libera.chat 372 cxl :-
>> :tantalum.libera.chat 372 cxl :- Welcome to Libera Chat, the IRC network for
>> :tantalum.libera.chat 372 cxl :- free & open-source software and peer directed projects.
>> :tantalum.libera.chat 372 cxl :-
>> :tantalum.libera.chat 372 cxl :- Use of Libera Chat is governed by our network policies.
>> :tantalum.libera.chat 372 cxl :-
>> :tantalum.libera.chat 372 cxl :- To reduce network abuses we perform open proxy checks
>> :tantalum.libera.chat 372 cxl :- on hosts at connection time.
>> :tantalum.libera.chat 372 cxl :-
>> :tantalum.libera.chat 372 cxl :- Please visit us in #libera for questions and support.
>> :tantalum.libera.chat 372 cxl :-
>> :tantalum.libera.chat 372 cxl :- Website and documentation:  https://libera.chat
>> :tantalum.libera.chat 372 cxl :- Webchat:                    https://web.libera.chat
>> :tantalum.libera.chat 372 cxl :- Network policies:           https://libera.chat/policies
>> :tantalum.libera.chat 372 cxl :- Email:                      support@libera.chat
>> :tantalum.libera.chat 376 cxl :End of /MOTD command.
>> :cxl!~hey_its_m@user/cxl MODE cxl :+Ziw

And only after it sends all of the above does it receive the MODE nope +i from irssi.

You could check this by running ZNC in debug mode (znc --debug). However, that doesn't really help, so... no idea what could be done about this.

> is sent too late. Uhm... when would be "not too late"? This is only a guess, but I bet that from ZNC's point of view, it sends the following all at once, even before irssi sends the MODE: ``` >> :tantalum.libera.chat 001 nope :Welcome to the Libera.Chat Internet Relay Chat Network cxl >> :tantalum.libera.chat 002 nope :Your host is tantalum.libera.chat[93.158.237.2/6697], running version solanum-1.0-dev >> :tantalum.libera.chat 003 nope :This server was created Mon Nov 22 2021 at 18:12:28 UTC >> :tantalum.libera.chat 004 nope tantalum.libera.chat solanum-1.0-dev DGQRSZaghilopsuwz CFILMPQSTbcefgijklmnopqrstuvz bkloveqjfI >> :tantalum.libera.chat 005 nope WHOX MONITOR=100 SAFELIST ELIST=CMNTU ETRACE FNC CALLERID=g KNOCK CHANTYPES=# EXCEPTS INVEX CHANMODES=eIbq,k,flj,CFLMPQSTcgimnprstuz :are supported by this server >> :tantalum.libera.chat 005 nope CHANLIMIT=#:250 PREFIX=(ov)@+ MAXLIST=bqeI:100 MODES=4 NETWORK=Libera.Chat STATUSMSG=@+ CASEMAPPING=rfc1459 NICKLEN=16 MAXNICKLEN=16 CHANNELLEN=50 TOPICLEN=390 DEAF=D :are supported by this server >> :tantalum.libera.chat 005 nope TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:4,NOTICE:4,ACCEPT:,MONITOR: EXTBAN=$,ajrxz :are supported by this server >> :tantalum.libera.chat 251 nope :There are 67 users and 42759 invisible on 28 servers >> :tantalum.libera.chat 252 nope 41 :IRC Operators online >> :tantalum.libera.chat 254 nope 21929 :channels formed >> :tantalum.libera.chat 255 nope :I have 655 clients and 1 servers >> :tantalum.libera.chat 265 nope 655 4545 :Current local users 655, max 4545 >> :tantalum.libera.chat 266 nope 42826 53550 :Current global users 42826, max 53550 >> :tantalum.libera.chat 250 nope :Highest connection count: 4546 (4545 clients) (368870 connections received) >> :nope!~hey_its_m@user/cxl NICK :cxl >> :tantalum.libera.chat 375 cxl :- tantalum.libera.chat Message of the Day - >> :tantalum.libera.chat 372 cxl :- This server provided by Hyperfilter (https://hyperfilter.com) >> :tantalum.libera.chat 372 cxl :- >> :tantalum.libera.chat 372 cxl :- >> :tantalum.libera.chat 372 cxl :- Welcome to Libera Chat, the IRC network for >> :tantalum.libera.chat 372 cxl :- free & open-source software and peer directed projects. >> :tantalum.libera.chat 372 cxl :- >> :tantalum.libera.chat 372 cxl :- Use of Libera Chat is governed by our network policies. >> :tantalum.libera.chat 372 cxl :- >> :tantalum.libera.chat 372 cxl :- To reduce network abuses we perform open proxy checks >> :tantalum.libera.chat 372 cxl :- on hosts at connection time. >> :tantalum.libera.chat 372 cxl :- >> :tantalum.libera.chat 372 cxl :- Please visit us in #libera for questions and support. >> :tantalum.libera.chat 372 cxl :- >> :tantalum.libera.chat 372 cxl :- Website and documentation: https://libera.chat >> :tantalum.libera.chat 372 cxl :- Webchat: https://web.libera.chat >> :tantalum.libera.chat 372 cxl :- Network policies: https://libera.chat/policies >> :tantalum.libera.chat 372 cxl :- Email: support@libera.chat >> :tantalum.libera.chat 376 cxl :End of /MOTD command. >> :cxl!~hey_its_m@user/cxl MODE cxl :+Ziw ``` And only after it sends all of the above does it receive the `MODE nope +i` from irssi. You could check this by running ZNC in debug mode (`znc --debug`). However, that doesn't really help, so... no idea what could be done about this. <!-- github-comment-id:1093976673 -->
Author
Owner

Couldn't >> :nope!~hey_its_m@user/cxl NICK :cxl be the first thing ZNC sends, even before >> :tantalum.libera.chat 001 nope :Welcome to the Libera.Chat Internet Relay Chat Network cxl? Just spitballing here, I don't know if that would make any sense.

Couldn't `>> :nope!~hey_its_m@user/cxl NICK :cxl` be the first thing ZNC sends, even before `>> :tantalum.libera.chat 001 nope :Welcome to the Libera.Chat Internet Relay Chat Network cxl`? Just spitballing here, I don't know if that would make any sense. <!-- github-comment-id:1094193506 -->
Author
Owner

I'm going to quote from the modern IRC docs' section about connection registration (without taking the time to trace each piece of information back to the RFCs, because the site is a reference for how things are implemented):

The first parameter of the RPL_WELCOME (001) message is the nickname assigned by the network to the client. Since it may differ from the nickname the client requested with the NICK command (due to, e.g. length limits or policy restrictions on nicknames), the client SHOULD use this parameter to determine its actual nickname at the time of connection. Subsequent nickname changes, client-initiated or not, will be communicated by the server sending a NICK message.

To me, it then seems incorrect that ZNC sends nope as the nick in 001 if the network side is connected as cxl. One could say ZNC has an implicit "limit or policy restriction on nicknames", and should inform the client as soon as possible that the NICK it requested was altered. The explicit NICK command sent later can be removed, then. Does that sound reasonable?

I'm going to quote from the modern IRC docs' [section about connection registration](https://modern.ircdocs.horse/#connection-registration) (without taking the time to trace each piece of information back to the RFCs, because the site is a reference for how things _are_ implemented): > The first parameter of the [RPL_WELCOME](https://modern.ircdocs.horse/#rplwelcome-001) (001) message is the nickname assigned by the network to the client. Since it may differ from the nickname the client requested with the [NICK](https://modern.ircdocs.horse/#nick-message) command (due to, e.g. length limits or policy restrictions on nicknames), the client SHOULD use this parameter to determine its actual nickname at the time of connection. Subsequent nickname changes, client-initiated or not, will be communicated by the server sending a NICK message. To me, it then seems incorrect that ZNC sends `nope` as the nick in 001 if the network side is connected as `cxl`. One could say ZNC has an implicit "limit or policy restriction on nicknames", and should inform the client as soon as possible that the NICK it requested was altered. The explicit NICK command sent later can be removed, then. Does that sound reasonable? <!-- github-comment-id:1094196922 -->
Author
Owner

I switched to SASL EXTERNAL and seems like this is still hapenning. My version is slightly outdated since it is the package from debian: 1.8.2+deb3.1+deb12u1.

I switched to SASL EXTERNAL and seems like this is still hapenning. My version is slightly outdated since it is the package from debian: 1.8.2+deb3.1+deb12u1. <!-- github-comment-id:2396837095 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#1010