Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correctly account for nickname in CAP LS arithmetic #1872

Merged
merged 1 commit into from
Dec 16, 2021

Conversation

slingamn
Copy link
Member

Before, CAP LS responses after registration could actually be truncated:

:ircs.redacted.site CAP asdfasdfasdf LS :account-notify account-tag away-notify batch cap-notify chghost draft/account-registration=before-connect,email-required draft/channel-rename draft/chathistory draft/event-playback draft/extended-monitor draft/languages=1,en draft/multiline=max-bytes=4096,max-lines=24 draft/relaymsg=/ echo-message ergo.chat/nope extended-join invite-notify labeled-response message-tags multi-prefix sasl=PLAIN,EXTERNAL server-time setname userhost-in-names znc.in/playback znc.in/sel

After this change, in my testing, we can produce a CAP LS response of exactly 510 bytes (not counting the \r\n), then adding a single additional character to the nickname pushes a token onto the next line:

nick aaaaaaaaaaa
:aaaaaaaaaaaa!~u@m5gy8jpgzbefg.irc NICK aaaaaaaaaaa
cap ls 302
:oragono.test CAP aaaaaaaaaaa LS * :account-notify account-tag away-notify batch cap-notify chghost draft/account-registration=before-connect,email-required draft/channel-rename draft/chathistory draft/event-playback draft/extended-monitor draft/languages=1,en draft/multiline=max-bytes=2048,max-lines=24 draft/relaymsg=/ echo-message ergo.chat/nope extended-join invite-notify labeled-response message-tags multi-prefix sasl=PLAIN,EXTERNAL server-time setname sts=duration=31536000,port=6697 userhost-in-names
:oragono.test CAP aaaaaaaaaaa LS :znc.in/playback znc.in/self-message
nick aaaaaaaaaaaa
:aaaaaaaaaaa!~u@m5gy8jpgzbefg.irc NICK aaaaaaaaaaaa
cap ls 302
:oragono.test CAP aaaaaaaaaaaa LS * :account-notify account-tag away-notify batch cap-notify chghost draft/account-registration=before-connect,email-required draft/channel-rename draft/chathistory draft/event-playback draft/extended-monitor draft/languages=1,en draft/multiline=max-bytes=2048,max-lines=24 draft/relaymsg=/ echo-message ergo.chat/nope extended-join invite-notify labeled-response message-tags multi-prefix sasl=PLAIN,EXTERNAL server-time setname sts=duration=31536000,port=6697
:oragono.test CAP aaaaaaaaaaaa LS :userhost-in-names znc.in/playback znc.in/self-message

The arithmetic was assuming that the nickname is * (which it is
pre-registration). However, we were sending the actual nickname
post-registration. It would be simpler to always send *, but it
appears that the nickname is actually required by the spec:

>Replies from the server must [sic] contain the client identifier name or
>asterisk if one is not yet available.
@slingamn slingamn added the bug label Dec 16, 2021
@slingamn slingamn added this to the v2.9 milestone Dec 16, 2021
@slingamn slingamn merged commit 5b3ec9a into ergochat:master Dec 16, 2021
@slingamn slingamn deleted the capbug.1 branch May 6, 2022 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant