浏览代码

disallow initial $ in nicknames

It collides with the massmessage mask syntax. Reported by @emersion
tags/v2.9.0-rc1
Shivaram Lingamneni 2 年前
父节点
当前提交
f40d868cf5
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8
    2
      irc/client_lookup_set.go

+ 8
- 2
irc/client_lookup_set.go 查看文件

@@ -97,8 +97,14 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
97 97
 	realname := client.realname
98 98
 	client.stateMutex.RUnlock()
99 99
 
100
-	if newNick != accountName && strings.ContainsAny(newNick, disfavoredNameCharacters) {
101
-		return "", errNicknameInvalid, false
100
+	// these restrictions have grandfather exceptions for nicknames registered
101
+	// on previous versions of Ergo:
102
+	if newNick != accountName {
103
+		// can't contain "disfavored" characters like <, or start with a $ because
104
+		// it collides with the massmessage mask syntax:
105
+		if strings.ContainsAny(newNick, disfavoredNameCharacters) || strings.HasPrefix(newNick, "$") {
106
+			return "", errNicknameInvalid, false
107
+		}
102 108
 	}
103 109
 
104 110
 	// recompute always-on status, because client.alwaysOn is not set for unregistered clients

正在加载...
取消
保存