summaryrefslogtreecommitdiff
path: root/src/modules/m_cloaking.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2016-11-12 18:55:26 -0500
committerAdam <Adam@anope.org>2016-11-13 11:26:19 -0500
commit0c78ad71d32e4062827f2ebac927bdbf43c091ba (patch)
tree2eb128f07dc208c982c74ad8cf44ff6f711076b7 /src/modules/m_cloaking.cpp
parentef23e4c07320fbbbf9d142878aae05a3e87eff0f (diff)
m_cloaking: fix host/ip comparisons #1249
Diffstat (limited to 'src/modules/m_cloaking.cpp')
-rw-r--r--src/modules/m_cloaking.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index 105d68833..1bf99f919 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -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);