From a6164cd9c40e6f5ac62d5d43a1366fe0f43efb63 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Fri, 24 May 2019 16:59:42 +0100 Subject: [PATCH] Check restricted nicknames against skeletons Fixes #519 --- irc/nickname.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/irc/nickname.go b/irc/nickname.go index a1919e59..093d8891 100644 --- a/irc/nickname.go +++ b/irc/nickname.go @@ -17,7 +17,7 @@ import ( ) var ( - // anything added here MUST be casefolded: + // anything added here MUST be skeleton'd: restrictedNicknames = map[string]bool{ "=scene=": true, // used for rp commands "histserv": true, // TODO(slingamn) this should become a real service @@ -27,7 +27,7 @@ var ( // returns whether the change succeeded or failed func performNickChange(server *Server, client *Client, target *Client, session *Session, newnick string, rb *ResponseBuffer) bool { nickname := strings.TrimSpace(newnick) - cfnick, err := CasefoldName(nickname) + skeleton, err := Skeleton(nickname) currentNick := client.Nick() if len(nickname) < 1 { @@ -35,7 +35,7 @@ func performNickChange(server *Server, client *Client, target *Client, session * return false } - if err != nil || len(nickname) > server.Config().Limits.NickLen || restrictedNicknames[cfnick] { + if err != nil || len(nickname) > server.Config().Limits.NickLen || restrictedNicknames[skeleton] { rb.Add(nil, server.name, ERR_ERRONEUSNICKNAME, currentNick, nickname, client.t("Erroneous nickname")) return false } @@ -68,7 +68,7 @@ func performNickChange(server *Server, client *Client, target *Client, session * } histItem.Params[0] = nickname - client.server.logger.Debug("nick", fmt.Sprintf("%s changed nickname to %s [%s]", origNickMask, nickname, cfnick)) + client.server.logger.Debug("nick", fmt.Sprintf("%s changed nickname to %s [%s]", origNickMask, nickname, skeleton)) if hadNick { if client == target { target.server.snomasks.Send(sno.LocalNicks, fmt.Sprintf(ircfmt.Unescape("$%s$r changed nickname to %s"), details.nick, nickname))