diff options
author | Adam <Adam@anope.org> | 2017-02-21 08:19:03 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-02-21 08:19:03 -0500 |
commit | 46d8af781d7d4b2d381ff43b13e0f3d176924271 (patch) | |
tree | 067cb4b4a35bacf98e7b9c8ae055b900e82b9451 /src/config.cpp | |
parent | 67b7c8bd7d90f3eed1400bf6540f67bfeb65d4ac (diff) |
Verify configured servername and uplink password are valid
Diffstat (limited to 'src/config.cpp')
-rw-r--r-- | src/config.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/config.cpp b/src/config.cpp index 5d20caf82..03ee9feb6 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -157,7 +157,13 @@ Conf::Conf() : Block("") Block *serverinfo = this->GetBlock("serverinfo"), *options = this->GetBlock("options"), *mail = this->GetBlock("mail"), *networkinfo = this->GetBlock("networkinfo"); - ValidateNotEmpty("serverinfo", "name", serverinfo->Get<const Anope::string>("name")); + const Anope::string &servername = serverinfo->Get<Anope::string>("name"); + + ValidateNotEmpty("serverinfo", "name", servername); + + if (servername.find(' ') != Anope::string::npos || servername.find('.') == Anope::string::npos) + throw ConfigException("serverinfo:name is not a valid server name"); + ValidateNotEmpty("serverinfo", "description", serverinfo->Get<const Anope::string>("description")); ValidateNotEmpty("serverinfo", "pid", serverinfo->Get<const Anope::string>("pid")); ValidateNotEmpty("serverinfo", "motd", serverinfo->Get<const Anope::string>("motd")); @@ -205,6 +211,9 @@ Conf::Conf() : Block("") ValidateNotZero("uplink", "port", port); ValidateNotEmpty("uplink", "password", password); + if (password.find(' ') != Anope::string::npos || password[0] == ':') + throw ConfigException("uplink:password is not valid"); + this->Uplinks.push_back(Uplink(host, port, password, ipv6)); } |