When connecting to ZNC, I see plenty of messages like 353 mk-fg = #control +mk-fg being dumped into the server buffer by the client (one for each previously-joined channel), which seem to happen because ZNC sends lines like :353 mk-fg = #control +mk-fg for each channel that client joins.
I think correct IRC protocol would be to send 353 mk-fg = #control +mk-fg without that leading colon.
ZNC never sends NAMES to the server in question and generates these (broken) lines internally in CChan::AttachUser, so it looks like incorrect behavior on the part of ZNC itself.
IRCd in question probably does something weird wrt its "[:source]" part of the messages (like not sending it in some cases), but that doesn't seem to be a violation of the IRC protocol, as "[:source]" is optional afaict, and maybe should be handled without breaking protocol on client connections regardless.
When connecting to ZNC, I see plenty of messages like `353 mk-fg = #control +mk-fg` being dumped into the server buffer by the client (one for each previously-joined channel), which seem to happen because ZNC sends lines like `:353 mk-fg = #control +mk-fg` for each channel that client joins.
I think correct IRC protocol would be to send `353 mk-fg = #control +mk-fg` without that leading colon.
ZNC never sends NAMES to the server in question and generates these (broken) lines internally in CChan::AttachUser, so it looks like incorrect behavior on the part of ZNC itself.
Confirmed by seeing these lines coming from ZNC in wireshark: https://i.imgur.com/LmrdUGf.jpg
IRCd in question probably does something weird wrt its "[:source]" part of the messages (like not sending it in some cases), but that doesn't seem to be a violation of the IRC protocol, as "[:source]" is optional afaict, and maybe should be handled without breaking protocol on client connections regardless.
ZNC version: 1.7.2-1 (Archlinux package)
OS: Archlinux amd64 (latest, rolling release)
<!-- github-sync-id:408455809 -->
What's the IRC server that is used here? In the screenshot that you showed on IRC, there was a space after the colon and the 353.
What's the IRC server that is used here? In the screenshot that you showed on IRC, there was a space after the colon and the `353`.
<!-- github-comment-id:462067608 -->
And decoding it via e.g. python2 -c "print '3a 33 35 33 20 6d 6b 2d 66 67 20 3d 20 23 63 6f 6e 74 72 6f 6c 20 3a 2b 6d 6b 2d 66 67'.replace(' ', '').decode('hex')" yields :353 mk-fg = #control :+mk-fg - no space after colon.
Or am I misunderstanding specific space/colon place that you mean?
> In the screenshot that you showed on IRC, there was a space after the colon and the 353.
Don't think it's the case, exact hex + ascii for this, as copied from wireshark is:
```
0000 3a 33 35 33 20 6d 6b 2d 66 67 20 3d 20 23 63 6f :353 mk-fg = #co
0010 6e 74 72 6f 6c 20 3a 2b 6d 6b 2d 66 67 ntrol :+mk-fg
```
And decoding it via e.g. `python2 -c "print '3a 33 35 33 20 6d 6b 2d 66 67 20 3d 20 23 63 6f 6e 74 72 6f 6c 20 3a 2b 6d 6b 2d 66 67'.replace(' ', '').decode('hex')"` yields `:353 mk-fg = #control :+mk-fg` - no space after colon.
Or am I misunderstanding specific space/colon place that you mean?
<!-- github-comment-id:462068086 -->
Obvious fix would be adding some dummy ":source" prefix to every line from server, but that looks like a workaround in this case, as mentioned in the initial report.
> What's the IRC server that is used here?
It's my own script - https://github.com/mk-fg/reliable-discord-client-irc-daemon
So would appreciate if you can spot and suggest what it does wrong when that connection happens.
Obvious fix would be adding some dummy ":source" prefix to every line from server, but that looks like a workaround in this case, as mentioned in the initial report.
<!-- github-comment-id:462068874 -->
... there was a space after the colon and the 353.
Btw, do see CString sPre = ":" + m_pNetwork->GetIRCServer() + " 353 " + ... in Chan.cpp, which should add that space, and that code didn't change for a while according to git, so guess either that 353 isn't generated there, message gets mangled later, or Arch package changes that part.
EDIT: it looks like line indeed might be parsed via BufLine.ToMessage() and re-assembled, which might be what's messing it up due to that empty source part.
> ... there was a space after the colon and the 353.
Btw, do see `CString sPre = ":" + m_pNetwork->GetIRCServer() + " 353 " + ...` in Chan.cpp, which should add that space, and that code didn't change for a while according to git, so guess either that 353 isn't generated there, message gets mangled later, or Arch package changes that part.
EDIT: it looks like line indeed might be parsed via BufLine.ToMessage() and re-assembled, which might be what's messing it up due to that empty source part.
<!-- github-comment-id:462070101 -->
The numeric reply MUST be sent as one message consisting of the sender prefix, the three-digit numeric, and the target of the reply.
ZNC uses the prefix of 001 to figure out the server name, see the call to SetIRCServer in IRCSock.cpp. Since you send 001 without a prefix, the IRC server is set to an empty string. Then, when ZNC later "invents" numeric replies, it uses this empty server name as prefix and things go downhill from there.
ZNC could be more robust here (I guess using some default in GetIRCServer in case the current server name is empty), but I'd also say that relable-discorc-client-irc-daemon could send prefixes.
> It's my own script - https://github.com/mk-fg/reliable-discord-client-irc-daemon
Okay... I did not figure out what that uses to generate the 001s, but whatever.
My reading of RFC 2812 requires servers to send a prefix for all numerics (source: https://tools.ietf.org/html/rfc2812#section-2.4)
> The numeric reply MUST be sent as one message consisting of the sender prefix, the three-digit numeric, and the target of the reply.
ZNC uses the prefix of 001 to figure out the server name, see the call to `SetIRCServer` in `IRCSock.cpp`. Since you send 001 without a prefix, the IRC server is set to an empty string. Then, when ZNC later "invents" numeric replies, it uses this empty server name as prefix and things go downhill from there.
ZNC could be more robust here (I guess using some default in `GetIRCServer` in case the current server name is empty), but I'd also say that relable-discorc-client-irc-daemon could send prefixes.
<!-- github-comment-id:462075447 -->
I can understand the confusion about the prefix being optional here because the previous section 2.3 says:
Each IRC message may consist of up to three main parts: the prefix (OPTIONAL), the command, and the command parameters (maximum of fifteen (15)).
However, "numeric replies" are specified as distinct from "messages" so the quoted "MUST" in 2.4 should taken to mean the prefix is not optional in numeric replies.
This is definitely a bug with the discord bridge, but yeah, would be worth hardening ZNC.
I can understand the confusion about the prefix being optional here because the previous section 2.3 says:
> Each IRC message may consist of up to three main parts: the prefix (OPTIONAL), the command, and the command parameters (maximum of fifteen (15)).
However, "numeric replies" are specified as distinct from "messages" so the quoted "MUST" in 2.4 should taken to mean the prefix is not optional in numeric replies.
This is definitely a bug with the discord bridge, but yeah, would be worth hardening ZNC.
<!-- github-comment-id:462077065 -->
I was mostly going by modern.ircdocs.horse when implementing that, where numeric-replies section says that they're non-special, and as such that part should be optional, guess I'll file a bug there.
I was mostly going by modern.ircdocs.horse when implementing that, where [numeric-replies](https://modern.ircdocs.horse/#numeric-replies) section says that they're non-special, and as such that part should be optional, guess I'll file a bug there.
<!-- github-comment-id:462077169 -->
Well, that part of modern is basically a copy/paste of the rfcs and has that same MUST. It could definitely be clarified, but it's not in conflict or incorrect.
Well, that part of modern is basically a copy/paste of the rfcs and has that same MUST. It could definitely be clarified, but it's not in conflict or incorrect.
<!-- github-comment-id:462077278 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
When connecting to ZNC, I see plenty of messages like
353 mk-fg = #control +mk-fgbeing dumped into the server buffer by the client (one for each previously-joined channel), which seem to happen because ZNC sends lines like:353 mk-fg = #control +mk-fgfor each channel that client joins.I think correct IRC protocol would be to send
353 mk-fg = #control +mk-fgwithout that leading colon.ZNC never sends NAMES to the server in question and generates these (broken) lines internally in CChan::AttachUser, so it looks like incorrect behavior on the part of ZNC itself.
Confirmed by seeing these lines coming from ZNC in wireshark: https://i.imgur.com/LmrdUGf.jpg
IRCd in question probably does something weird wrt its "[:source]" part of the messages (like not sending it in some cases), but that doesn't seem to be a violation of the IRC protocol, as "[:source]" is optional afaict, and maybe should be handled without breaking protocol on client connections regardless.
ZNC version: 1.7.2-1 (Archlinux package)
OS: Archlinux amd64 (latest, rolling release)
What's the IRC server that is used here? In the screenshot that you showed on IRC, there was a space after the colon and the
353.Don't think it's the case, exact hex + ascii for this, as copied from wireshark is:
And decoding it via e.g.
python2 -c "print '3a 33 35 33 20 6d 6b 2d 66 67 20 3d 20 23 63 6f 6e 74 72 6f 6c 20 3a 2b 6d 6b 2d 66 67'.replace(' ', '').decode('hex')"yields:353 mk-fg = #control :+mk-fg- no space after colon.Or am I misunderstanding specific space/colon place that you mean?
You've also asked about 001 message upon connecting in #znc on freenode.
ZNC gives this one to client:
And this is what server sends to ZNC upon connecting:
"001 mk-fg :Welcome to the rdircd discord-irc bridge, mk-fg\r\n"Log for stuff being sent to ZNC upon connection:
EDIT: there's PASS command in there, but it's not a security issue of any kind to expose it in this case.
It's my own script - https://github.com/mk-fg/reliable-discord-client-irc-daemon
So would appreciate if you can spot and suggest what it does wrong when that connection happens.
Obvious fix would be adding some dummy ":source" prefix to every line from server, but that looks like a workaround in this case, as mentioned in the initial report.
Btw, do see
CString sPre = ":" + m_pNetwork->GetIRCServer() + " 353 " + ...in Chan.cpp, which should add that space, and that code didn't change for a while according to git, so guess either that 353 isn't generated there, message gets mangled later, or Arch package changes that part.EDIT: it looks like line indeed might be parsed via BufLine.ToMessage() and re-assembled, which might be what's messing it up due to that empty source part.
Okay... I did not figure out what that uses to generate the 001s, but whatever.
My reading of RFC 2812 requires servers to send a prefix for all numerics (source: https://tools.ietf.org/html/rfc2812#section-2.4)
ZNC uses the prefix of 001 to figure out the server name, see the call to
SetIRCServerinIRCSock.cpp. Since you send 001 without a prefix, the IRC server is set to an empty string. Then, when ZNC later "invents" numeric replies, it uses this empty server name as prefix and things go downhill from there.ZNC could be more robust here (I guess using some default in
GetIRCServerin case the current server name is empty), but I'd also say that relable-discorc-client-irc-daemon could send prefixes.I can understand the confusion about the prefix being optional here because the previous section 2.3 says:
However, "numeric replies" are specified as distinct from "messages" so the quoted "MUST" in 2.4 should taken to mean the prefix is not optional in numeric replies.
This is definitely a bug with the discord bridge, but yeah, would be worth hardening ZNC.
I was mostly going by modern.ircdocs.horse when implementing that, where numeric-replies section says that they're non-special, and as such that part should be optional, guess I'll file a bug there.
Well, that part of modern is basically a copy/paste of the rfcs and has that same MUST. It could definitely be clarified, but it's not in conflict or incorrect.
Oh, you're right, sorry, I just read it and somehow missed the "MUST" part, my bad, definitely not incorrect.
I filed a clarifying PR for modern: https://github.com/ircdocs/modern-irc/pull/72
Thanks!