summaryrefslogtreecommitdiff
path: root/src/config.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-09-09 23:43:11 -0400
committerAdam <Adam@anope.org>2010-09-09 23:43:11 -0400
commit46813ccb8c6ab572b8a9ff0a39afb1d92dc4482b (patch)
tree562da502a102230ce207bbe921fdc978ee71e20c /src/config.cpp
parentfdd196e50b4616ac377bd0ee0ae5ce6c57b657ee (diff)
Added an asynchronous DNS system and m_dnsbl, which checks clients against DNS blacklists.
Rewrote internal handling of IPs, we now properly support users using IPv6. Fixed a few problems with the UnrealIRCd protocol module.
Diffstat (limited to 'src/config.cpp')
-rw-r--r--src/config.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/config.cpp b/src/config.cpp
index d43f97e6f..d8ac4f863 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -349,6 +349,36 @@ ServerConfig::ServerConfig() : errstr(""), config_data()
}
SetDefaultMLock(this);
+
+ if (IsFile(this->NameServer))
+ {
+ std::ifstream f(this->NameServer.c_str());
+ Anope::string server;
+ bool success = false;
+
+ while (f.is_open() && getline(f, server.str()))
+ {
+ if (server.find("nameserver ") == 0 && getline(f, server.str()))
+ {
+ if (server.substr(11).is_pos_number_only())
+ {
+ this->NameServer = server.substr(11);
+ Log(LOG_DEBUG) << "Nameserver set to " << this->NameServer;
+ success = true;
+ break;
+ }
+ }
+ }
+
+ if (f.is_open())
+ f.close();
+
+ if (!success)
+ {
+ Log() << "Unable to find nameserver, defaulting to 127.0.0.1";
+ this->NameServer = "127.0.0.1";
+ }
+ }
}
bool ServerConfig::CheckOnce(const Anope::string &tag)
@@ -1053,6 +1083,8 @@ void ServerConfig::Read()
{"mail", "restrict", "no", new ValueContainerBool(&this->RestrictMail), DT_BOOLEAN, NoValidation},
{"mail", "delay", "0", new ValueContainerTime(&this->MailDelay), DT_TIME, NoValidation},
{"mail", "dontquoteaddresses", "no", new ValueContainerBool(&this->DontQuoteAddresses), DT_BOOLEAN, NoValidation},
+ {"dns", "nameserver", "127.0.0.1", new ValueContainerString(&this->NameServer), DT_STRING, NoValidation},
+ {"dns", "timeout", "5", new ValueContainerTime(&this->DNSTimeout), DT_TIME, NoValidation},
{"chanserv", "nick", "ChanServ", new ValueContainerString(&this->s_ChanServ), DT_STRING | DT_NORELOAD, ValidateNotEmpty},
{"chanserv", "description", "Channel Registration Service", new ValueContainerString(&this->desc_ChanServ), DT_STRING | DT_NORELOAD, ValidateNotEmpty},
{"chanserv", "modules", "", new ValueContainerString(&ChanCoreModules), DT_STRING, NoValidation},