]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_dnsbl.cpp
Fix problem with autoconnects: don't reset NextConnectTime to a higher value than...
[user/henk/code/inspircd.git] / src / modules / m_dnsbl.cpp
index b68767933619f25dfc5ad14e01f0ae03fad3c76b..0c3c2df7d91e3b96c9eff72a43f32650e1a7648a 100644 (file)
@@ -143,7 +143,7 @@ class DNSBLResolver : public Resolver
                                                        {
                                                                ServerInstance->XLines->ApplyLines();
                                                        }
-                                                       else 
+                                                       else
                                                                delete zl;
                                                        break;
                                                }
@@ -156,7 +156,7 @@ class DNSBLResolver : public Resolver
 
                                        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
@@ -212,7 +212,7 @@ class ModuleDNSBL : public Module
 
        virtual Version GetVersion()
        {
-               return Version(2, 0, 0, 1, VF_VENDOR, API_VERSION);
+               return Version("$Id$", VF_VENDOR, API_VERSION);
        }
 
 
@@ -247,7 +247,7 @@ class ModuleDNSBL : public Module
                        }
                        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;
@@ -257,11 +257,11 @@ class ModuleDNSBL : public Module
 
                        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 */
-                       if (e->bitmask <= 0)
+                       if ((e->bitmask <= 0) && (DNSBLConfEntry::A_BITMASK == e->type))
                        {
                                ServerInstance->SNO->WriteToSnoMask('A', "DNSBL(#%d): invalid bitmask",i);
                        }
@@ -312,26 +312,9 @@ class ModuleDNSBL : public Module
                        unsigned char a, b, c, d;
                        char reversedipbuf[128];
                        std::string reversedip;
-                       bool success = false;
+                       bool success;
 
-                       if (!inet_aton(user->GetIPString(), &in))
-                       {
-#ifdef IPV6
-                               /* We could have an ipv6 address here */
-                               std::string x = user->GetIPString();
-                               /* Is it a 4in6 address? (Compensate for this kernel kludge that people love) */
-                               if (x.find("0::ffff:") == 0)
-                               {
-                                       x.erase(x.begin(), x.begin() + 8);
-                                       if (inet_aton(x.c_str(), &in))
-                                               success = true;
-                               }
-#endif
-                       }
-                       else
-                       {
-                               success = true;
-                       }
+                       success = inet_aton(user->GetIPString(), &in);
 
                        if (!success)
                                return 0;
@@ -360,26 +343,26 @@ class ModuleDNSBL : public Module
                /* 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;
        }
 };