From f2566ff550bc3516eb35fab76217384866de8bcb Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 21 Apr 2013 05:41:09 +0100 Subject: Move to . --- docs/conf/inspircd.conf.example | 14 +++++++++----- include/users.h | 4 ++++ src/commands/cmd_hostname_lookup.cpp | 10 ++-------- src/configreader.cpp | 14 ++++++++------ src/modules/m_cgiirc.cpp | 5 ++--- src/users.cpp | 6 ++++-- 6 files changed, 29 insertions(+), 24 deletions(-) diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example index 173355acd..e0ed5e67e 100644 --- a/docs/conf/inspircd.conf.example +++ b/docs/conf/inspircd.conf.example @@ -275,6 +275,10 @@ # maxconnwarn: Enable warnings when localmax or globalmax is hit (defaults to on) maxconnwarn="off" + # nouserdns: If enabled, no DNS lookups will be performed on connecting users + # in this class. This can save a lot of resources on very busy servers. + nouserdns="no" + # usednsbl: Defines whether or not users in this class are subject to DNSBL. Default is yes. # This setting only has effect when m_dnsbl is loaded. #usednsbl="yes" @@ -380,6 +384,10 @@ # globalmax: Maximum global (network-wide) connections per IP. globalmax="3" + # nouserdns: If enabled, no DNS lookups will be performed on connecting users + # in this class. This can save a lot of resources on very busy servers. + nouserdns="no" + # useident: Defines if users in this class must respond to a ident query or not. useident="no" @@ -647,11 +655,7 @@ # +C and +Q snomasks. Setting this to yes squelches those messages, # which makes it easier for opers, but degrades the functionality of # bots like BOPM during netsplits. - quietbursts="yes" - - # nouserdns: If enabled, no DNS lookups will be performed on - # connecting users. This can save a lot of resources on very busy servers. - nouserdns="no"> + quietbursts="yes"> #-#-#-#-#-#-#-#-#-#-#-# SECURITY CONFIGURATION #-#-#-#-#-#-#-#-#-#-#-# # # diff --git a/include/users.h b/include/users.h index 9b7d28d31..0f57074b2 100644 --- a/include/users.h +++ b/include/users.h @@ -144,6 +144,10 @@ struct CoreExport ConnectClass : public refcountbase */ unsigned long limit; + /** If set to true, no user DNS lookups are to be performed + */ + bool nouserdns; + /** Create a new connect class with no settings. */ ConnectClass(ConfigTag* tag, char type, const std::string& mask); diff --git a/src/commands/cmd_hostname_lookup.cpp b/src/commands/cmd_hostname_lookup.cpp index 04592c6e5..d43730b94 100644 --- a/src/commands/cmd_hostname_lookup.cpp +++ b/src/commands/cmd_hostname_lookup.cpp @@ -177,7 +177,6 @@ class UserResolver : public DNS::Request class ModuleHostnameLookup : public Module { - bool nouserdns; LocalIntExt dnsLookup; LocalStringExt ptrHosts; dynamic_reference DNS; @@ -198,18 +197,13 @@ class ModuleHostnameLookup : public Module ServerInstance->Modules->AddService(this->dnsLookup); ServerInstance->Modules->AddService(this->ptrHosts); - Implementation i[] = { I_OnUserInit, I_OnCheckReady, I_OnRehash }; + Implementation i[] = { I_OnUserInit, I_OnCheckReady }; ServerInstance->Modules->Attach(i, this, sizeof(i) / sizeof(Implementation)); } - void OnRehash(User* user) - { - nouserdns = ServerInstance->Config->ConfValue("performance")->getBool("nouserdns"); - } - void OnUserInit(LocalUser *user) { - if (!DNS || nouserdns) + if (!DNS || user->MyClass->nouserdns) { user->WriteServ("NOTICE %s :*** Skipping host resolution (disabled by server administrator)", user->nick.c_str()); return; diff --git a/src/configreader.cpp b/src/configreader.cpp index 32e8966fa..1b565c7f7 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -313,6 +313,7 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) me->maxchans = tag->getInt("maxchans", me->maxchans); me->maxconnwarn = tag->getBool("maxconnwarn", me->maxconnwarn); me->limit = tag->getInt("limit", me->limit); + me->nouserdns = tag->getBool("nouserdns", me->nouserdns); ClassMap::iterator oldMask = oldBlocksByMask.find(typeMask); if (oldMask != oldBlocksByMask.end()) @@ -346,12 +347,13 @@ struct DeprecatedConfig }; static const DeprecatedConfig ChangedConfig[] = { - { "bind", "transport", "", "has been moved to as of 2.0" }, - { "die", "value", "", "you need to reread your config" }, - { "link", "autoconnect", "", "2.0+ does not use this attribute - define tags instead" }, - { "link", "transport", "", "has been moved to as of 2.0" }, - { "module", "name", "m_chanprotect.so", "has been replaced with m_customprefix as of 2.2" }, - { "module", "name", "m_halfop.so", "has been replaced with m_customprefix as of 2.2" }, + { "bind", "transport", "", "has been moved to as of 2.0" }, + { "die", "value", "", "you need to reread your config" }, + { "link", "autoconnect", "", "2.0+ does not use this attribute - define tags instead" }, + { "link", "transport", "", "has been moved to as of 2.0" }, + { "module", "name", "m_chanprotect.so", "has been replaced with m_customprefix as of 2.2" }, + { "module", "name", "m_halfop.so", "has been replaced with m_customprefix as of 2.2" }, + { "performance", "nouserdns", "", "has been moved to as of 2.2" } }; void ServerConfig::Fill() diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 9d87a01b3..bbb6151bd 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -182,7 +182,6 @@ class ModuleCgiIRC : public Module CommandWebirc cmd; LocalIntExt waiting; dynamic_reference DNS; - bool nouserdns; static void RecheckClass(LocalUser* user) { @@ -207,8 +206,9 @@ class ModuleCgiIRC : public Module user->host = user->dhost = user->GetIPString(); user->InvalidateCache(); RecheckClass(user); + // Don't create the resolver if the core couldn't put the user in a connect class or when dns is disabled - if (user->quitting || !DNS || nouserdns) + if (user->quitting || !DNS || user->MyClass->nouserdns) return; CGIResolver* r = new CGIResolver(*this->DNS, this, cmd.notify, newip, user, (was_pass ? "PASS" : "IDENT"), waiting); @@ -248,7 +248,6 @@ public: void OnRehash(User* user) { - nouserdns = ServerInstance->Config->ConfValue("performance")->getBool("nouserdns"); cmd.Hosts.clear(); // Do we send an oper notice when a CGI:IRC has their host changed? diff --git a/src/users.cpp b/src/users.cpp index d6363171c..623af7fe3 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1610,7 +1610,8 @@ const std::string& FakeUser::GetFullRealHost() ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask) : config(tag), type(t), fakelag(true), name("unnamed"), registration_timeout(0), host(mask), pingtime(0), softsendqmax(0), hardsendqmax(0), recvqmax(0), - penaltythreshold(0), commandrate(0), maxlocal(0), maxglobal(0), maxconnwarn(true), maxchans(0), limit(0) + penaltythreshold(0), commandrate(0), maxlocal(0), maxglobal(0), maxconnwarn(true), maxchans(0), + limit(0), nouserdns(false) { } @@ -1620,7 +1621,7 @@ ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask, cons softsendqmax(parent.softsendqmax), hardsendqmax(parent.hardsendqmax), recvqmax(parent.recvqmax), penaltythreshold(parent.penaltythreshold), commandrate(parent.commandrate), maxlocal(parent.maxlocal), maxglobal(parent.maxglobal), maxconnwarn(parent.maxconnwarn), maxchans(parent.maxchans), - limit(parent.limit) + limit(parent.limit), nouserdns(parent.nouserdns) { } @@ -1643,4 +1644,5 @@ void ConnectClass::Update(const ConnectClass* src) maxconnwarn = src->maxconnwarn; maxchans = src->maxchans; limit = src->limit; + nouserdns = src->nouserdns; } -- cgit v1.2.3