diff options
| author | Adam <Adam@anope.org> | 2010-09-14 16:12:47 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2010-09-14 16:12:47 -0400 |
| commit | 630f3815ce5e1eac9dd8f82601c955131c3dce68 (patch) | |
| tree | 42eee984b00963f6cf5540f2be6024fc2d8f91e7 /modules/extra | |
| parent | 4da2af64ecc04c979179041b5c37c85e4ab56650 (diff) | |
Added a config option to make operserv not add users found in the dsnbl to the akill list
Diffstat (limited to 'modules/extra')
| -rw-r--r-- | modules/extra/m_dnsbl.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/modules/extra/m_dnsbl.cpp b/modules/extra/m_dnsbl.cpp index a72e8ac3b..42e505c31 100644 --- a/modules/extra/m_dnsbl.cpp +++ b/modules/extra/m_dnsbl.cpp @@ -20,20 +20,22 @@ class DNSBLResolver : public DNSRequest { dynamic_reference<User> user; Blacklist blacklist; + bool add_to_akill; + public: - DNSBLResolver(User *u, const Blacklist &b, const Anope::string &host) : DNSRequest(host, DNS_QUERY_A, true), user(u), blacklist(b) { } + DNSBLResolver(User *u, const Blacklist &b, const Anope::string &host, bool add_akill) : DNSRequest(host, DNS_QUERY_A, true), user(u), blacklist(b), add_to_akill(add_akill) { } void OnLookupComplete(const DNSRecord *) { - if (!user || !SGLine) + if (!user) return; Anope::string reason = this->blacklist.reason; reason = reason.replace_all_ci("%i", user->ip.addr()); reason = reason.replace_all_ci("%h", user->host); - XLine *x = SGLine->Add(NULL, NULL, Anope::string("*@") + user->host, Anope::CurTime + this->blacklist.bantime, reason); - if (x) + XLine *x = NULL; + if (this->add_to_akill && SGLine && (x = SGLine->Add(NULL, NULL, Anope::string("*@") + user->host, Anope::CurTime + this->blacklist.bantime, reason))) { static Command command_akill("AKILL", 0); command_akill.service = OperServ; @@ -42,6 +44,12 @@ class DNSBLResolver : public DNSRequest if (!Config->AkillOnAdd) ircdproto->SendAkill(x); } + else + { + Log(OperServ) << "DNSBL: " << user->GetMask() << " appears in " << this->blacklist.name; + XLine xline(Anope::string("*@") + user->host, OperServ->nick, Anope::CurTime + this->blacklist.bantime, reason); + ircdproto->SendAkill(&xline); + } } }; @@ -50,6 +58,7 @@ class ModuleDNSBL : public Module std::vector<Blacklist> blacklists; bool check_on_connect; bool check_on_netburst; + bool add_to_akill; public: ModuleDNSBL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) @@ -69,6 +78,7 @@ class ModuleDNSBL : public Module this->check_on_connect = config.ReadFlag("m_dnsbl", "check_on_connect", "no", 0); this->check_on_netburst = config.ReadFlag("m_dnsbl", "check_on_netburst", "no", 0); + this->add_to_akill = config.ReadFlag("m_dnsbl", "add_to_akill", "yes", 0); this->blacklists.clear(); for (int i = 0, num = config.Enumerate("blacklist"); i < num; ++i) @@ -110,7 +120,7 @@ class ModuleDNSBL : public Module try { Anope::string dnsbl_host = user_ip.addr() + "." + b.name; - new DNSBLResolver(u, b, dnsbl_host); + new DNSBLResolver(u, b, dnsbl_host, this->add_to_akill); } catch (const SocketException &ex) { |
