]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_dnsbl.cpp
Make more config stuff case insensitive.
[user/henk/code/inspircd.git] / src / modules / m_dnsbl.cpp
index 16694de932fe937278123c6c98cbd234289f282e..e0a827f0442494080817fa98b111e37d5d492401 100644 (file)
@@ -278,7 +278,7 @@ class ModuleDNSBL : public Module, public Stats::EventListener
                        e->reason = tag->getString("reason");
                        e->domain = tag->getString("domain");
 
-                       if (tag->getString("type") == "bitmask")
+                       if (stdalgo::string::equalsci(tag->getString("type"), "bitmask"))
                        {
                                e->type = DNSBLConfEntry::A_BITMASK;
                                e->bitmask = tag->getUInt("bitmask", 0, 0, UINT_MAX);
@@ -339,6 +339,10 @@ class ModuleDNSBL : public Module, public Stats::EventListener
                if ((user->exempt) || !DNS)
                        return;
 
+               // Clients can't be in a DNSBL if they aren't connected via IPv4 or IPv6.
+               if (user->client_sa.family() != AF_INET && user->client_sa.family() != AF_INET6)
+                       return;
+
                if (user->MyClass)
                {
                        if (!user->MyClass->config->getBool("usednsbl", true))
@@ -348,7 +352,7 @@ class ModuleDNSBL : public Module, public Stats::EventListener
                        ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "User has no connect class in OnSetUserIP");
 
                std::string reversedip;
-               if (user->client_sa.sa.sa_family == AF_INET)
+               if (user->client_sa.family() == AF_INET)
                {
                        unsigned int a, b, c, d;
                        d = (unsigned int) (user->client_sa.in4.sin_addr.s_addr >> 24) & 0xFF;
@@ -358,7 +362,7 @@ class ModuleDNSBL : public Module, public Stats::EventListener
 
                        reversedip = ConvToStr(d) + "." + ConvToStr(c) + "." + ConvToStr(b) + "." + ConvToStr(a);
                }
-               else if (user->client_sa.sa.sa_family == AF_INET6)
+               else if (user->client_sa.family() == AF_INET6)
                {
                        const unsigned char* ip = user->client_sa.in6.sin6_addr.s6_addr;