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:
@@ -27,7 +27,6 @@ const (
|
||||
pollInterval = 100 * time.Millisecond
|
||||
pingInterval = 90 * time.Second
|
||||
pongDeadline = 30 * time.Second
|
||||
maxNickLen = 32
|
||||
minPasswordLen = 8
|
||||
maxHashcashBits = 40
|
||||
)
|
||||
@@ -426,11 +425,16 @@ func (c *Conn) handlePreRegistration(
|
||||
return
|
||||
}
|
||||
|
||||
c.nick = msg.Params[0]
|
||||
if len(c.nick) > maxNickLen {
|
||||
c.nick = c.nick[:maxNickLen]
|
||||
if !service.ValidNick(msg.Params[0]) {
|
||||
c.sendNumeric(
|
||||
irc.ErrErroneusNickname,
|
||||
msg.Params[0], "Erroneous nickname",
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
c.nick = msg.Params[0]
|
||||
c.gotNick = true
|
||||
case irc.CmdUser:
|
||||
if len(msg.Params) < 4 { //nolint:mnd
|
||||
|
||||
Reference in New Issue
Block a user