diff options
author | Peter Powell <petpow@saberuk.com> | 2018-06-29 11:28:53 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2018-07-10 21:14:56 +0100 |
commit | 32eb5386ba181e23fb5274a919a6fd7463805674 (patch) | |
tree | bec117e9de1b5f8d9b9a4c94b4803f1a9a98de79 /src/configreader.cpp | |
parent | 87361360e67d105df148ba0daa52f1164ce1d15a (diff) |
Switch <server:name> validation to use InspIRCd::IsHost.
Diffstat (limited to 'src/configreader.cpp')
-rw-r--r-- | src/configreader.cpp | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index b5d6b3ecb..125bf595d 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -72,26 +72,6 @@ ServerConfig::~ServerConfig() delete EmptyTag; } -static void ValidHost(const std::string& p, const std::string& msg) -{ - int num_dots = 0; - if (p.empty() || p[0] == '.') - throw CoreException("The value of "+msg+" is not a valid hostname"); - for (unsigned int i=0;i < p.length();i++) - { - switch (p[i]) - { - case ' ': - throw CoreException("The value of "+msg+" is not a valid hostname"); - case '.': - num_dots++; - break; - } - } - if (num_dots == 0) - throw CoreException("The value of "+msg+" is not a valid hostname"); -} - bool ServerConfig::ApplyDisabledCommands() { // Enable everything first. @@ -389,8 +369,7 @@ void ServerConfig::Fill() ConfigTag* server = ConfValue("server"); if (sid.empty()) { - ServerName = server->getString("name", "irc.example.com"); - ValidHost(ServerName, "<server:name>"); + ServerName = server->getString("name", "irc.example.com", InspIRCd::IsHost); sid = server->getString("id"); if (!sid.empty() && !InspIRCd::IsSID(sid)) |