]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
m_cloaking: fix host/ip comparisons #1249
authorAdam <Adam@anope.org>
Sat, 12 Nov 2016 23:55:26 +0000 (18:55 -0500)
committerAdam <Adam@anope.org>
Sun, 13 Nov 2016 16:26:19 +0000 (11:26 -0500)
src/modules/m_cloaking.cpp

index 105d688337d20d0afb767059815bf10ace8c5671..1bf99f919f8550e9aaf21f0e9aee983898376fcd 100644 (file)
@@ -493,11 +493,14 @@ class ModuleCloaking : public Module
        {
                std::string chost;
 
+               irc::sockets::sockaddrs hostip;
+               bool host_is_ip = irc::sockets::aptosa(host, ip.port(), hostip) && hostip == ip;
+
                switch (mode)
                {
                        case MODE_COMPAT_HOST:
                        {
-                               if (ipstr != host)
+                               if (!host_is_ip)
                                {
                                        std::string tail = LastTwoDomainParts(host);
 
@@ -520,7 +523,7 @@ class ModuleCloaking : public Module
                                break;
                        case MODE_HALF_CLOAK:
                        {
-                               if (ipstr != host)
+                               if (!host_is_ip)
                                        chost = prefix + SegmentCloak(host, 1, 6) + LastTwoDomainParts(host);
                                if (chost.empty() || chost.length() > 50)
                                        chost = SegmentIP(ip, false);