downstream: fail on client or network name mismatch

This probably indicates a mis-configuration.

git-svn-id: file:///srv/svn/repo/suika/trunk@790 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit is contained in:
contact 2022-03-03 07:50:37 +00:00
parent 0327068bdd
commit a4fa4b48f7

View File

@ -1290,9 +1290,19 @@ func (dc *downstreamConn) register(ctx context.Context) error {
_, fallbackClientName, fallbackNetworkName := unmarshalUsername(dc.rawUsername)
if dc.clientName == "" {
dc.clientName = fallbackClientName
} else if dc.clientName != fallbackClientName {
return ircError{&irc.Message{
Command: irc.ERR_ERRONEUSNICKNAME,
Params: []string{dc.nick, "Client name mismatch in usernames"},
}}
}
if dc.networkName == "" {
dc.networkName = fallbackNetworkName
} else if dc.networkName != fallbackNetworkName {
return ircError{&irc.Message{
Command: irc.ERR_ERRONEUSNICKNAME,
Params: []string{dc.nick, "Network name mismatch in usernames"},
}}
}
dc.registered = true