mirror of
https://github.com/anope/anope.git
synced 2026-07-01 16:26:38 +02:00
Verify configured servername and uplink password are valid
This commit is contained in:
+10
-1
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user