]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_cloaking.cpp
Make more config stuff case insensitive.
[user/henk/code/inspircd.git] / src / modules / m_cloaking.cpp
index e5f912c95ffa30cc8ea42b0709fb43261ead210f..ad4b958c58ac89f6ff4b9a736dcf9c4f597b9082 100644 (file)
@@ -223,7 +223,7 @@ class ModuleCloaking : public Module
                size_t hop1, hop2, hop3;
                size_t len1, len2;
                std::string rv;
-               if (ip.sa.sa_family == AF_INET6)
+               if (ip.family() == AF_INET6)
                {
                        bindata = std::string((const char*)ip.in6.sin6_addr.s6_addr, 16);
                        hop1 = 8;
@@ -267,7 +267,7 @@ class ModuleCloaking : public Module
                }
                else
                {
-                       if (ip.sa.sa_family == AF_INET6)
+                       if (ip.family() == AF_INET6)
                        {
                                rv.append(InspIRCd::Format(".%02x%02x.%02x%02x%s",
                                        ip.in6.sin6_addr.s6_addr[2], ip.in6.sin6_addr.s6_addr[3],
@@ -350,12 +350,12 @@ class ModuleCloaking : public Module
                suffix = tag->getString("suffix", ".IP");
 
                std::string modestr = tag->getString("mode");
-               if (modestr == "half")
+               if (stdalgo::string::equalsci(modestr, "half"))
                {
                        mode = MODE_HALF_CLOAK;
-                       domainparts = tag->getInt("domainparts", 3, 1, 10);
+                       domainparts = tag->getUInt("domainparts", 3, 1, 10);
                }
-               else if (modestr == "full")
+               else if (stdalgo::string::equalsci(modestr, "full"))
                        mode = MODE_OPAQUE;
                else
                        throw ModuleException("Bad value for <cloak:mode>; must be half or full");
@@ -395,6 +395,10 @@ class ModuleCloaking : public Module
                if (cloak)
                        return;
 
+               // TODO: decide how we are going to cloak AF_UNIX hostnames.
+               if (dest->client_sa.family() != AF_INET && dest->client_sa.family() != AF_INET6)
+                       return;
+
                cu.ext.set(dest, GenCloak(dest->client_sa, dest->GetIPString(), dest->GetRealHost()));
        }
 };