From 32eb5386ba181e23fb5274a919a6fd7463805674 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 29 Jun 2018 11:28:53 +0100 Subject: [PATCH] Switch validation to use InspIRCd::IsHost. --- src/configreader.cpp | 23 +---------------------- 1 file changed, 1 insertion(+), 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, ""); + ServerName = server->getString("name", "irc.example.com", InspIRCd::IsHost); sid = server->getString("id"); if (!sid.empty() && !InspIRCd::IsSID(sid)) -- 2.39.5