forked from External/ergo
improve nick and channel length validation
This commit is contained in:
parent
108ef3f424
commit
8123e3c08f
3 changed files with 19 additions and 9 deletions
|
|
@ -28,6 +28,7 @@ import (
|
|||
"github.com/oragono/oragono/irc/ldap"
|
||||
"github.com/oragono/oragono/irc/logger"
|
||||
"github.com/oragono/oragono/irc/modes"
|
||||
"github.com/oragono/oragono/irc/mysql"
|
||||
"github.com/oragono/oragono/irc/passwd"
|
||||
"github.com/oragono/oragono/irc/utils"
|
||||
"gopkg.in/yaml.v2"
|
||||
|
|
@ -817,6 +818,11 @@ func LoadConfig(filename string) (config *Config, err error) {
|
|||
if config.Limits.RegistrationMessages == 0 {
|
||||
config.Limits.RegistrationMessages = 1024
|
||||
}
|
||||
if config.Datastore.MySQL.Enabled {
|
||||
if config.Limits.NickLen > mysql.MaxTargetLength || config.Limits.ChannelLen > mysql.MaxTargetLength {
|
||||
return nil, fmt.Errorf("to use MySQL, nick and channel length limits must be %d or lower", mysql.MaxTargetLength)
|
||||
}
|
||||
}
|
||||
|
||||
config.Server.supportedCaps = caps.NewCompleteSet()
|
||||
config.Server.capValues = make(caps.Values)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue