/* $ModDesc: Provides handling of DNS blacklists */
/* Class holding data for a single entry */
-class DNSBLConfEntry
+class DNSBLConfEntry : public classbase
{
public:
enum EnumBanaction { I_UNKNOWN, I_KILL, I_ZLINE, I_KLINE, I_GLINE };
{
case DNSBLConfEntry::I_KILL:
{
- User::QuitUser(ServerInstance, them, std::string("Killed (") + reason + ")");
+ ServerInstance->Users->QuitUser(them, std::string("Killed (") + reason + ")");
break;
}
case DNSBLConfEntry::I_KLINE:
{
ServerInstance->XLines->ApplyLines();
}
- else
+ else
delete zl;
break;
}
if (show)
{
- ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as being on a DNS blacklist (%s) with result %d", them->GetFullRealHost(), ConfEntry->name.c_str(), bitmask);
+ ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as being on a DNS blacklist (%s) with result %d", them->GetFullRealHost().c_str(), ConfEntry->name.c_str(), bitmask);
}
}
else
virtual Version GetVersion()
{
- return Version(2, 0, 0, 1, VF_VENDOR, API_VERSION);
+ return Version("$Id$", VF_VENDOR, API_VERSION);
}
}
else
{
- memset(e->records, 0, 256);
+ memset(e->records, 0, sizeof(e->records));
e->type = DNSBLConfEntry::A_RECORD;
irc::portparser portrange(MyConf->ReadValue("dnsbl", "records", i), false);
long item = -1;
e->banaction = str2banaction(MyConf->ReadValue("dnsbl", "action", i));
e->duration = ServerInstance->Duration(MyConf->ReadValue("dnsbl", "duration", i));
-
+
/* Use portparser for record replies */
/* yeah, logic here is a little messy */
/* don't do anything with this hot potato */
return 0;
}
-
+
virtual int OnStats(char symbol, User* user, string_list &results)
{
if (symbol != 'd')
return 0;
-
+
unsigned long total_hits = 0, total_misses = 0;
for (std::vector<DNSBLConfEntry*>::iterator i = DNSBLConfEntries.begin(); i != DNSBLConfEntries.end(); i++)
{
total_hits += (*i)->stats_hits;
total_misses += (*i)->stats_misses;
-
+
results.push_back(std::string(ServerInstance->Config->ServerName) + " 304 " + user->nick + " :DNSBLSTATS DNSbl \"" + (*i)->name + "\" had " +
ConvToStr((*i)->stats_hits) + " hits and " + ConvToStr((*i)->stats_misses) + " misses");
}
-
+
results.push_back(std::string(ServerInstance->Config->ServerName) + " 304 " + user->nick + " :DNSBLSTATS Total hits: " + ConvToStr(total_hits));
results.push_back(std::string(ServerInstance->Config->ServerName) + " 304 " + user->nick + " :DNSBLSTATS Total misses: " + ConvToStr(total_misses));
-
+
return 0;
}
};