Compare nicks by exact case everywhere (closes #128)
check / check (push) Waiting to run

README.md rules that nicks are case-sensitive, but the IRC listener's
relay and user MODE on both transports compared nicks ignoring case:
an IRC listener user alice never saw a PRIVMSG, NOTICE, JOIN, PART,
NICK or QUIT from Alice, and MODE Alice from alice was taken as her
own nick. These checks now use ==.

Tests cover alice receiving each of these from Alice, MODE Alice from
alice getting 502 on both transports, and Alice registering while
alice exists. README.md drops the text that described the old
behaviour.

Model: opus-5-5
This commit was merged in pull request #141.
This commit is contained in:
2026-10-20 16:31:28 +02:00
parent 3c725a9ca8
commit eceb5f2b2c
8 changed files with 66 additions and 31 deletions
+2 -3
View File
@@ -254,8 +254,7 @@ func (hdlr *Handlers) handleWallops(
// handleUserMode handles MODE for a nick: a query when the
// body is empty, otherwise a change by the mode string in
// the body. Only the caller's own nick, in any letter case,
// is allowed.
// the body. Only the caller's own nick is allowed.
func (hdlr *Handlers) handleUserMode(
writer http.ResponseWriter,
request *http.Request,
@@ -263,7 +262,7 @@ func (hdlr *Handlers) handleUserMode(
nick, target string,
bodyLines func() []string,
) {
if !strings.EqualFold(target, nick) {
if target != nick {
hdlr.respondIRCError(
writer, request, clientID, sessionID,
irc.ErrUsersDoNotMatch, nick, nil,