3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-14 07:59:31 +01:00
enable the use of grouped nicks as account names for SASL,
if force-nick-equals-account is disabled
This commit is contained in:
Shivaram Lingamneni 2021-01-12 09:10:39 -05:00
parent f2a40b9e5d
commit bafadf3aac

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
}