Check nicks on the IRC listener with the HTTP API's rule (closes #142)
check / check (push) Waiting to run
check / check (push) Waiting to run
The nick rule moves from internal/handlers to internal/service as ValidNick, and the HTTP API and both IRC listener NICK paths call it. The IRC listener used to cut a nick to 32 bytes and accept anything else, so a nick with spaces such as "bob PRIVMSG #inj :hi" made the lines built from it read as another user's PRIVMSG. It now answers a nick the rule refuses with ERR_ERRONEUSNICKNAME (432), before and after registration, and keeps the nick as it was. Model: opus-5-5
This commit was merged in pull request #152.
This commit is contained in:
@@ -71,8 +71,13 @@ func (c *Conn) handleNick(
|
||||
}
|
||||
|
||||
newNick := msg.Params[0]
|
||||
if len(newNick) > maxNickLen {
|
||||
newNick = newNick[:maxNickLen]
|
||||
if !service.ValidNick(newNick) {
|
||||
c.sendNumeric(
|
||||
irc.ErrErroneusNickname,
|
||||
newNick, "Erroneous nickname",
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
oldMask := c.hostmask()
|
||||
|
||||
Reference in New Issue
Block a user