X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fconfigreader.cpp;h=6ef5105aa5003d4c93ad216011035504f604f50d;hb=061a762095e983d07382f61cd69611a082792668;hp=c2c66fc316efa0d407520edf029fad821a5e924e;hpb=d7b1e9fb444b1e9c71dd863b1f33ada09197a0f4;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/configreader.cpp b/src/configreader.cpp index c2c66fc31..6ef5105aa 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -21,7 +21,7 @@ ServerConfig::ServerConfig() { WhoWasGroupSize = WhoWasMaxGroups = WhoWasMaxKeep = 0; - NoUserDns = OperSpyWhois = HideBans = HideSplits = UndernetMsgPrefix = false; + RawLog = NoUserDns = HideBans = HideSplits = UndernetMsgPrefix = false; WildcardIPv6 = CycleHosts = InvBypassModes = true; dns_timeout = 5; MaxTargets = 20; @@ -148,8 +148,11 @@ static void FindDNS(std::string& server) if (server == "nameserver") { resolv >> server; - ServerInstance->Logs->Log("CONFIG",DEFAULT," set to '%s' as first resolver in /etc/resolv.conf.",server.c_str()); - return; + if (server.find_first_not_of("0123456789.") == std::string::npos) + { + ServerInstance->Logs->Log("CONFIG",DEFAULT," set to '%s' as first resolver in /etc/resolv.conf.",server.c_str()); + return; + } } } @@ -231,7 +234,7 @@ void ServerConfig::CrossCheckOperClassType() if (tblk == oper_blocks.end()) throw CoreException("Oper block " + name + " has missing type " + type); if (oper_blocks.find(name) != oper_blocks.end()) - throw CoreException("Duplicate oper block with name " + name); + throw CoreException("Duplicate oper block with name " + name + " at " + tag->getTagLocation()); OperInfo* ifo = new OperInfo; ifo->name = type; @@ -473,7 +476,6 @@ void ServerConfig::Fill() HideBans = security->getBool("hidebans"); HideWhoisServer = security->getString("hidewhois"); HideKillsServer = security->getString("hidekills"); - OperSpyWhois = security->getBool("operspywhois"); RestrictBannedUsers = security->getBool("restrictbannedusers", true); GenericOper = security->getBool("genericoper"); NoUserDns = ConfValue("performance")->getBool("nouserdns"); @@ -529,7 +531,7 @@ void ServerConfig::Fill() if (socktest < 0) WildcardIPv6 = false; else - close(socktest); + ServerInstance->SE->Close(socktest); } ConfigTagList tags = ConfTags("uline"); for(ConfigIter i = tags.first; i != tags.second; ++i) @@ -585,6 +587,14 @@ void ServerConfig::Fill() else AnnounceInvites = ServerConfig::INVITE_ANNOUNCE_NONE; + v = security->getString("operspywhois"); + if (v == "splitmsg") + OperSpyWhois = SPYWHOIS_SPLITMSG; + else if (v == "on" || v == "yes") + OperSpyWhois = SPYWHOIS_SINGLEMSG; + else + OperSpyWhois = SPYWHOIS_NONE; + Limits.Finalise(); } @@ -647,12 +657,13 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid) errstr << ce.GetReason(); } - // write once here, to try it out and make sure its ok - ServerInstance->WritePID(this->PID); - // Check errors before dealing with failed binds, since continuing on failed bind is wanted in some circumstances. valid = errstr.str().empty(); + // write once here, to try it out and make sure its ok + if (valid) + ServerInstance->WritePID(this->PID); + if (old) { // On first run, ports are bound later on @@ -681,19 +692,16 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid) { std::string line; getline(errstr, line, '\n'); - if (!line.empty()) - { - if (user) - user->WriteServ("NOTICE %s :*** %s", user->nick.c_str(), line.c_str()); - else - ServerInstance->SNO->WriteGlobalSno('a', line); - } - + if (line.empty()) + continue; + // On startup, print out to console (still attached at this point) if (!old) - { - // Starting up, so print it out so it's seen. XXX this is a bit of a hack. printf("%s\n", line.c_str()); - } + // If a user is rehashing, tell them directly + if (user) + user->SendText(":%s NOTICE %s :*** %s", ServerInstance->Config->ServerName.c_str(), user->nick.c_str(), line.c_str()); + // Also tell opers + ServerInstance->SNO->WriteGlobalSno('a', line); } errstr.clear(); @@ -717,7 +725,8 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid) ApplyModules(user); if (user) - user->WriteServ("NOTICE %s :*** Successfully rehashed server.", user->nick.c_str()); + user->SendText(":%s NOTICE %s :*** Successfully rehashed server.", + ServerInstance->Config->ServerName.c_str(), user->nick.c_str()); ServerInstance->SNO->WriteGlobalSno('a', "*** Successfully rehashed server."); } @@ -856,9 +865,7 @@ void ConfigReaderThread::Finish() { ServerConfig* old = ServerInstance->Config; ServerInstance->Logs->Log("CONFIG",DEBUG,"Switching to new configuration..."); - ServerInstance->Logs->CloseLogs(); ServerInstance->Config = this->Config; - ServerInstance->Logs->OpenFileLogs(); Config->Apply(old, TheUserUID); if (Config->valid) @@ -879,13 +886,17 @@ void ConfigReaderThread::Finish() FOREACH_MOD(I_OnRehash, OnRehash(user)); ServerInstance->BuildISupport(); + ServerInstance->Logs->CloseLogs(); + ServerInstance->Logs->OpenFileLogs(); + + if (Config->RawLog && !old->RawLog) + ServerInstance->Users->ServerNoticeAll("*** Raw I/O logging is enabled on this server. All messages, passwords, and commands are being recorded."); + Config = old; } else { // whoops, abort! - ServerInstance->Logs->CloseLogs(); ServerInstance->Config = old; - ServerInstance->Logs->OpenFileLogs(); } }