3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-29 15:40:02 +01:00

Merge pull request #1481 from slingamn/issue1476_grouped_sasl

fix #1476
This commit is contained in:
Shivaram Lingamneni 2021-01-15 06:17:45 -05:00 committed by GitHub
commit 2fd537fc52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1041,6 +1041,21 @@ func (am *AccountManager) SetNickReserved(client *Client, nick string, saUnreser
func (am *AccountManager) checkPassphrase(accountName, passphrase string) (account ClientAccount, err error) {
account, err = am.LoadAccount(accountName)
// #1476: if grouped nicks are allowed, attempt to interpret accountName as a grouped nick
if err == errAccountDoesNotExist && !am.server.Config().Accounts.NickReservation.ForceNickEqualsAccount {
cfnick, cfErr := CasefoldName(accountName)
if cfErr != nil {
return
}
accountName = func() string {
am.RLock()
defer am.RUnlock()
return am.nickToAccount[cfnick]
}()
if accountName != "" {
account, err = am.LoadAccount(accountName)
}
}
if err != nil {
return
}