3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

strings: Restrict *? explicitly as they are used for mask matching

This commit is contained in:
Daniel Oaks 2016-06-15 17:41:53 +10:00
parent 3a9a643d30
commit fd6ed36995

View File

@ -38,13 +38,16 @@ func (name Name) IsChannel() bool {
func (name Name) IsNickname() bool { func (name Name) IsNickname() bool {
namestr := name.String() namestr := name.String()
// * is used for unregistered clients // * is used for unregistered clients
// * is used for mask matching
// ? is used for mask matching
// , is used as a separator by the protocol // , is used as a separator by the protocol
// # is a channel prefix
// @+ are channel membership prefixes
// ! separates username from nickname // ! separates username from nickname
// @ separates nick+user from hostname // @ separates nick+user from hostname
if namestr == "*" || strings.Contains(namestr, ",") || strings.Contains("#@+", string(namestr[0])) || // # is a channel prefix
strings.Contains(namestr, "!") || strings.Contains(namestr, "@") { // @+ are channel membership prefixes
if strings.Contains(namestr, "*") || strings.Contains(namestr, "?") ||
strings.Contains(namestr, ",") || strings.Contains(namestr, "!") ||
strings.Contains(namestr, "@") || strings.Contains("#@+", string(namestr[0])) {
return false return false
} }
// names that look like hostnames are restricted to servers, as with other ircds // names that look like hostnames are restricted to servers, as with other ircds