-/* +------------------------------------+
- * | Inspire Internet Relay Chat Daemon |
- * +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
*
- * InspIRCd: (C) 2002-2010 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ * Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
+ * Copyright (C) 2007-2009 Robin Burchell <robin+git@viroteck.net>
+ * Copyright (C) 2006-2009 Dennis Friis <peavey@inspircd.org>
+ * Copyright (C) 2006-2008 Craig Edwards <craigedwards@brainbox.cc>
+ * Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org>
+ * Copyright (C) 2006 Oliver Lupton <oliverlupton@gmail.com>
*
- * This program is free but copyrighted software; see
- * the file COPYING for details.
+ * This file is part of InspIRCd. InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
*
- * ---------------------------------------------------
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "inspircd.h"
#include <fstream>
#include "xline.h"
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;
if (server == "nameserver")
{
resolv >> server;
- ServerInstance->Logs->Log("CONFIG",DEFAULT,"<dns:server> 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,"<dns:server> set to '%s' as first resolver in /etc/resolv.conf.",server.c_str());
+ return;
+ }
}
}
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;
me->maxlocal = tag->getInt("localmax", me->maxlocal);
me->maxglobal = tag->getInt("globalmax", me->maxglobal);
me->maxchans = tag->getInt("maxchans", me->maxchans);
+ me->maxconnwarn = tag->getBool("maxconnwarn", me->maxconnwarn);
me->limit = tag->getInt("limit", me->limit);
ClassMap::iterator oldMask = oldBlocksByMask.find(typeMask);
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");
SyntaxHints = options->getBool("syntaxhints");
CycleHosts = options->getBool("cyclehosts");
+ CycleHostsFromUser = options->getBool("cyclehostsfromuser");
UndernetMsgPrefix = options->getBool("ircumsgprefix");
FullHostInTopic = options->getBool("hostintopic");
MaxTargets = security->getInt("maxtargets", 20);
Limits.MaxGecos = ConfValue("limits")->getInt("maxgecos", 128);
Limits.MaxAway = ConfValue("limits")->getInt("maxaway", 200);
InvBypassModes = options->getBool("invitebypassmodes", true);
+ NoSnoticeStack = options->getBool("nosnoticestack", false);
range(SoftLimit, 10, ServerInstance->SE->GetMaxFds(), ServerInstance->SE->GetMaxFds(), "<performance:softlimit>");
range(MaxConn, 0, SOMAXCONN, SOMAXCONN, "<performance:somaxconn>");
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)
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();
}
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
{
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();
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.");
}
{
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)
* thoroughly!!!
*/
ServerInstance->XLines->CheckELines();
- ServerInstance->XLines->CheckELines();
ServerInstance->XLines->ApplyLines();
ServerInstance->Res->Rehash();
ServerInstance->ResetMaxBans();
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();
}
}