rename config keys from review feedback

This commit is contained in:
Shivaram Lingamneni
2020-03-16 23:25:50 -04:00
parent 851c9ef198
commit edd161ddfd
5 changed files with 15 additions and 15 deletions
+2 -2
View File
@@ -348,11 +348,11 @@ func (am *AccountManager) Register(client *Client, account string, callbackNames
// as an account; this prevents "land-grab" situations where someone else
// registers your nick out from under you and then NS GHOSTs you
// n.b. client is nil during a SAREGISTER
// n.b. if EnforceGuestFormat, then there's no concern, because you can't
// n.b. if ForceGuestFormat, then there's no concern, because you can't
// register a guest nickname anyway, and the actual registration system
// will prevent any double-register
if client != nil && config.Accounts.NickReservation.Enabled &&
!config.Accounts.NickReservation.EnforceGuestFormat &&
!config.Accounts.NickReservation.ForceGuestFormat &&
client.NickCasefolded() != casefoldedAccount {
return errAccountMustHoldNick
}
+2 -2
View File
@@ -131,7 +131,7 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
var alwaysOn, useAccountName bool
if account != "" {
alwaysOn = persistenceEnabled(config.Accounts.Multiclient.AlwaysOn, settings.AlwaysOn)
useAccountName = alwaysOn || config.Accounts.NickReservation.EnforceAccountName
useAccountName = alwaysOn || config.Accounts.NickReservation.ForceNickEqualsAccount
}
if useAccountName {
@@ -150,7 +150,7 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
return "", errNickMissing
}
if account == "" && config.Accounts.NickReservation.EnforceGuestFormat {
if account == "" && config.Accounts.NickReservation.ForceGuestFormat {
newNick = strings.Replace(config.Accounts.NickReservation.GuestFormat, "*", newNick, 1)
}
+6 -6
View File
@@ -251,12 +251,12 @@ type AccountConfig struct {
AllowCustomEnforcement bool `yaml:"allow-custom-enforcement"`
RenameTimeout time.Duration `yaml:"rename-timeout"`
// RenamePrefix is the legacy field, GuestFormat is the new version
RenamePrefix string `yaml:"rename-prefix"`
GuestFormat string `yaml:"guest-nickname-format"`
guestRegexp *regexp.Regexp
guestRegexpFolded *regexp.Regexp
EnforceGuestFormat bool `yaml:"enforce-guest-format"`
EnforceAccountName bool `yaml:"enforce-account-name"`
RenamePrefix string `yaml:"rename-prefix"`
GuestFormat string `yaml:"guest-nickname-format"`
guestRegexp *regexp.Regexp
guestRegexpFolded *regexp.Regexp
ForceGuestFormat bool `yaml:"force-guest-format"`
ForceNickEqualsAccount bool `yaml:"force-nick-equals-account"`
} `yaml:"nick-reservation"`
Multiclient MulticlientConfig
Bouncer *MulticlientConfig // # handle old name for 'multiclient'
+3 -3
View File
@@ -610,12 +610,12 @@ func nsLoginThrottleCheck(client *Client, rb *ResponseBuffer) (success bool) {
return true
}
// if enforce-account-name is set, account name and nickname must be equal,
// if force-nick-equals-account is set, account name and nickname must be equal,
// so we need to re-NICK automatically on every login event (IDENTIFY,
// VERIFY, and a REGISTER that auto-verifies). if we can't get the nick
// then we log them out (they will be able to reattach with SASL)
func nsFixNickname(client *Client, rb *ResponseBuffer, config *Config) (success bool) {
if !config.Accounts.NickReservation.EnforceAccountName {
if !config.Accounts.NickReservation.ForceNickEqualsAccount {
return true
}
// don't need to supply a nickname, SetNick will use the account name
@@ -753,7 +753,7 @@ func nsRegisterHandler(server *Server, client *Client, command string, params []
config := server.Config()
account := details.nick
if config.Accounts.NickReservation.EnforceGuestFormat {
if config.Accounts.NickReservation.ForceGuestFormat {
matches := config.Accounts.NickReservation.guestRegexp.FindStringSubmatch(account)
if matches == nil || len(matches) < 2 {
nsNotice(rb, client.t("Erroneous nickname"))