summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2017-03-05 21:35:03 +0100
committerGitHub <noreply@github.com>2017-03-05 21:35:03 +0100
commit567a117817fffb369ca9cc7fb0d55e3850ac41a7 (patch)
tree6104af7cabd379adc792fa809344e1c3afcb0ffb /src
parentc79f9233725473b05dc92f9a85fd1775ba61a44c (diff)
parent0c78ad71d32e4062827f2ebac927bdbf43c091ba (diff)
Merge pull request #1266 from Adam-/insp20+cloakip
m_cloaking: fix host/ip comparisons #1249
Diffstat (limited to 'src')
-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);