From 8014b79b0c4f5d58d231e68189e298ea2859f653 Mon Sep 17 00:00:00 2001 From: danieldg Date: Sat, 17 Oct 2009 02:40:24 +0000 Subject: Add some default values that I missed (thanks for pointing it out, jdhore); move file reading into thread git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11881 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/configreader.cpp | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/configreader.cpp b/src/configreader.cpp index 10fea3eff..5d9c3c4d2 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -231,15 +231,12 @@ bool ServerConfig::ApplyDisabledCommands(const std::string& data) #ifdef WINDOWS // Note: the windows validator is in win32wrapper.cpp -void ValidateDnsServer(std::string& server); +void FindDNS(std::string& server); #else -static void ValidateDnsServer(std::string& server) +static void FindDNS(std::string& server) { if (!server.empty()) - { - ValidIP(server, ""); return; - } // attempt to look up their nameserver from /etc/resolv.conf ServerInstance->Logs->Log("CONFIG",DEFAULT,"WARNING: not defined, attempting to find working server in /etc/resolv.conf..."); @@ -497,15 +494,15 @@ void ServerConfig::Fill() HideWhoisServer = security->getString("hidewhois"); HideKillsServer = security->getString("hidekills"); OperSpyWhois = security->getBool("operspywhois"); - RestrictBannedUsers = security->getBool("restrictbannedusers"); + RestrictBannedUsers = security->getBool("restrictbannedusers", true); GenericOper = security->getBool("genericoper"); NoUserDns = ConfValue("performance")->getBool("nouserdns"); SyntaxHints = options->getBool("syntaxhints"); CycleHosts = options->getBool("cyclehosts"); UndernetMsgPrefix = options->getBool("ircumsgprefix"); FullHostInTopic = options->getBool("hostintopic"); - MaxTargets = security->getInt("maxtargets"); - DefaultModes = options->getString("defaultmodes"); + MaxTargets = security->getInt("maxtargets", 20); + DefaultModes = options->getString("defaultmodes", "nt"); PID = ConfValue("pid")->getString("file"); WhoWasGroupSize = ConfValue("whowas")->getInt("groupsize"); WhoWasMaxGroups = ConfValue("whowas")->getInt("maxgroups"); @@ -515,20 +512,16 @@ void ServerConfig::Fill() OperMaxChans = ConfValue("channels")->getInt("opers"); c_ipv4_range = ConfValue("cidr")->getInt("ipv4clone"); c_ipv6_range = ConfValue("cidr")->getInt("ipv6clone"); - Limits.NickMax = ConfValue("limits")->getInt("maxnick"); - Limits.ChanMax = ConfValue("limits")->getInt("maxchan"); - Limits.MaxModes = ConfValue("limits")->getInt("maxmodes"); - Limits.IdentMax = ConfValue("limits")->getInt("maxident"); - Limits.MaxQuit = ConfValue("limits")->getInt("maxquit"); - Limits.MaxTopic = ConfValue("limits")->getInt("maxtopic"); - Limits.MaxKick = ConfValue("limits")->getInt("maxkick"); - Limits.MaxGecos = ConfValue("limits")->getInt("maxgecos"); - Limits.MaxAway = ConfValue("limits")->getInt("maxaway"); - InvBypassModes = options->getBool("invitebypassmodes"); - - ReadFile(MOTD, ConfValue("files")->getString("motd")); - ReadFile(RULES, ConfValue("files")->getString("rules")); - ValidateDnsServer(DNSServer); + Limits.NickMax = ConfValue("limits")->getInt("maxnick", 32); + Limits.ChanMax = ConfValue("limits")->getInt("maxchan", 64); + Limits.MaxModes = ConfValue("limits")->getInt("maxmodes", 20); + Limits.IdentMax = ConfValue("limits")->getInt("maxident", 11); + Limits.MaxQuit = ConfValue("limits")->getInt("maxquit", 255); + Limits.MaxTopic = ConfValue("limits")->getInt("maxtopic", 307); + Limits.MaxKick = ConfValue("limits")->getInt("maxkick", 255); + Limits.MaxGecos = ConfValue("limits")->getInt("maxgecos", 128); + Limits.MaxAway = ConfValue("limits")->getInt("maxaway", 200); + InvBypassModes = options->getBool("invitebypassmodes", true); range(SoftLimit, 10, ServerInstance->SE->GetMaxFds(), ServerInstance->SE->GetMaxFds(), ""); range(MaxConn, 0, SOMAXCONN, SOMAXCONN, ""); @@ -539,6 +532,7 @@ void ServerConfig::Fill() range(WhoWasMaxGroups, 0, 1000000, 10240, ""); range(WhoWasMaxKeep, 3600, INT_MAX, 3600, ""); + ValidIP(DNSServer, ""); ValidHost(ServerName, ""); if (!sid.empty() && !ServerInstance->IsSID(sid)) throw CoreException(sid + " is not a valid server ID. A server ID must be 3 characters long, with the first character a digit and the next two characters a digit or letter."); @@ -1385,6 +1379,10 @@ void ConfigReaderThread::Run() { Config = new ServerConfig; Config->Read(); + Config->ReadFile(Config->MOTD, Config->ConfValue("files")->getString("motd")); + Config->ReadFile(Config->RULES, Config->ConfValue("files")->getString("rules")); + FindDNS(Config->DNSServer); + done = true; } -- cgit v1.2.3