]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_dnsbl.cpp
Add IP address conversion utility functions, irc::sockets::aptosa and irc::sockets...
[user/henk/code/inspircd.git] / src / modules / m_dnsbl.cpp
index 4598d62699bbad433864fbefe1d1f7a518a2e85d..9122486fc86fd2e8953420453d596ffffb60c5a9 100644 (file)
@@ -73,7 +73,7 @@ class DNSBLResolver : public Resolver
                        if(result.length())
                        {
                                unsigned int bitmask = 0, record = 0;
-                               bool show = false, match = false;
+                               bool match = false;
                                in_addr resultip;
 
                                inet_aton(result.c_str(), &resultip);
@@ -117,6 +117,8 @@ class DNSBLResolver : public Resolver
                                                                        "*", them->GetIPString());
                                                        if (ServerInstance->XLines->AddLine(kl,NULL))
                                                        {
+                                                               ServerInstance->SNO->WriteToSnoMask('x',"m_dnsbl added K:line on *@%s to expire on %s (%s).", 
+                                                                       them->GetIPString(), ServerInstance->TimeString(kl->expiry).c_str(), reason.c_str());
                                                                ServerInstance->XLines->ApplyLines();
                                                        }
                                                        else
@@ -129,6 +131,8 @@ class DNSBLResolver : public Resolver
                                                                        "*", them->GetIPString());
                                                        if (ServerInstance->XLines->AddLine(gl,NULL))
                                                        {
+                                                               ServerInstance->SNO->WriteToSnoMask('x',"m_dnsbl added G:line on *@%s to expire on %s (%s).", 
+                                                                       them->GetIPString(), ServerInstance->TimeString(gl->expiry).c_str(), reason.c_str());
                                                                ServerInstance->XLines->ApplyLines();
                                                        }
                                                        else
@@ -141,6 +145,8 @@ class DNSBLResolver : public Resolver
                                                                        them->GetIPString());
                                                        if (ServerInstance->XLines->AddLine(zl,NULL))
                                                        {
+                                                               ServerInstance->SNO->WriteToSnoMask('x',"m_dnsbl added Z:line on *@%s to expire on %s (%s).", 
+                                                                       them->GetIPString(), ServerInstance->TimeString(zl->expiry).c_str(), reason.c_str());
                                                                ServerInstance->XLines->ApplyLines();
                                                        }
                                                        else
@@ -154,10 +160,7 @@ class DNSBLResolver : public Resolver
                                                break;
                                        }
 
-                                       if (show)
-                                       {
-                                               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);
-                                       }
+                                       ServerInstance->SNO->WriteGlobalSno('a', "Connecting user %s detected as being on a DNS blacklist (%s) with result %d", them->GetFullRealHost().c_str(), ConfEntry->name.c_str(), (ConfEntry->type==DNSBLConfEntry::A_BITMASK) ? bitmask : record);
                                }
                                else
                                        ConfEntry->stats_misses++;
@@ -263,25 +266,25 @@ class ModuleDNSBL : public Module
                        /* yeah, logic here is a little messy */
                        if ((e->bitmask <= 0) && (DNSBLConfEntry::A_BITMASK == e->type))
                        {
-                               ServerInstance->SNO->WriteToSnoMask('A', "DNSBL(#%d): invalid bitmask",i);
+                               ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(#%d): invalid bitmask",i);
                        }
                        else if (e->name.empty())
                        {
-                               ServerInstance->SNO->WriteToSnoMask('A', "DNSBL(#%d): Invalid name",i);
+                               ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(#%d): Invalid name",i);
                        }
                        else if (e->domain.empty())
                        {
-                               ServerInstance->SNO->WriteToSnoMask('A', "DNSBL(#%d): Invalid domain",i);
+                               ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(#%d): Invalid domain",i);
                        }
                        else if (e->banaction == DNSBLConfEntry::I_UNKNOWN)
                        {
-                               ServerInstance->SNO->WriteToSnoMask('A', "DNSBL(#%d): Invalid banaction", i);
+                               ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(#%d): Invalid banaction", i);
                        }
                        else
                        {
                                if (e->reason.empty())
                                {
-                                       ServerInstance->SNO->WriteToSnoMask('A', "DNSBL(#%d): empty reason, using defaults",i);
+                                       ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(#%d): empty reason, using defaults",i);
                                        e->reason = "Your IP has been blacklisted.";
                                }