Prevent downstreams from changing their nick to service's
This commit prevents downstream from sending those commands: - NICK BouncerServ - NICK BouncerServ/<network> The later is necessary because soju would otherwise save the nick change and, in the event that the downstream connects in single-upstream mode to <network>, it will end up with the nickname "BouncerServ".
This commit is contained in:
parent
e797d90c59
commit
16c68b21b5
@ -1068,11 +1068,12 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
|
||||
Params: []string{dc.nick, "You may not reregister"},
|
||||
}}
|
||||
case "NICK":
|
||||
var nick string
|
||||
if err := parseMessageParams(msg, &nick); err != nil {
|
||||
var rawNick string
|
||||
if err := parseMessageParams(msg, &rawNick); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
nick := rawNick
|
||||
var upstream *upstreamConn
|
||||
if dc.upstream() == nil {
|
||||
uc, unmarshaledNick, err := dc.unmarshalEntity(nick)
|
||||
@ -1088,6 +1089,12 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
|
||||
Params: []string{dc.nick, nick, "contains illegal characters"},
|
||||
}}
|
||||
}
|
||||
if nick == serviceNick {
|
||||
return ircError{&irc.Message{
|
||||
Command: irc.ERR_NICKNAMEINUSE,
|
||||
Params: []string{dc.nick, rawNick, "Nickname reserved for bouncer service"},
|
||||
}}
|
||||
}
|
||||
|
||||
var err error
|
||||
dc.forEachNetwork(func(n *network) {
|
||||
|
Loading…
Reference in New Issue
Block a user