This commit is contained in:
Shivaram Lingamneni 2020-04-23 01:38:12 -04:00
parent eebe681538
commit 40d3c59139
4 changed files with 23 additions and 11 deletions

View file

@ -205,9 +205,18 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
// the client may just be changing case
if currentClient != nil && currentClient != client && session != nil {
// these conditions forbid reattaching to an existing session:
if registered || !bouncerAllowed || account == "" || account != currentClient.Account() || client.HasMode(modes.TLS) != currentClient.HasMode(modes.TLS) {
if registered || !bouncerAllowed || account == "" || account != currentClient.Account() {
return "", errNicknameInUse
}
// check TLS modes
if client.HasMode(modes.TLS) != currentClient.HasMode(modes.TLS) {
if useAccountName {
// #955: this is fatal because they can't fix it by trying a different nick
return "", errInsecureReattach
} else {
return "", errNicknameInUse
}
}
reattachSuccessful, numSessions, lastSeen := currentClient.AddSession(session)
if !reattachSuccessful {
return "", errNicknameInUse