diff options
| author | 2017-10-12 15:07:45 +0100 | |
|---|---|---|
| committer | 2017-10-12 15:07:45 +0100 | |
| commit | 1522ba9800db574bf19504fa3b1bfa86112f96b2 (patch) | |
| tree | e1f726cd5fc9b220313787e56daf768146e5af57 /src/modules | |
| parent | Fix a broken distro constraint in the m_ssl_gnutls PackageInfo. (diff) | |
| parent | Make domainparts configureable (diff) | |
| download | inspircd++-1522ba9800db574bf19504fa3b1bfa86112f96b2.tar.gz inspircd++-1522ba9800db574bf19504fa3b1bfa86112f96b2.tar.bz2 inspircd++-1522ba9800db574bf19504fa3b1bfa86112f96b2.zip | |
Merge pull request #1353 from SISheogorath/master+domainpart-cloaking
Make domainparts in m_cloaking configureable.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/m_cloaking.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index cb3fdac1a..7e9c78b31 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -143,6 +143,7 @@ class ModuleCloaking : public Module std::string prefix; std::string suffix; std::string key; + unsigned int domainparts; dynamic_reference<HashProvider> Hash; ModuleCloaking() : cu(this), mode(MODE_OPAQUE), ck(this), Hash(this, "hash/md5") @@ -160,7 +161,7 @@ class ModuleCloaking : public Module */ std::string LastTwoDomainParts(const std::string &host) { - int dots = 0; + unsigned int dots = 0; std::string::size_type splitdot = host.length(); for (std::string::size_type x = host.length() - 1; x; --x) @@ -170,7 +171,7 @@ class ModuleCloaking : public Module splitdot = x; dots++; } - if (dots >= 3) + if (dots >= domainparts) break; } @@ -314,7 +315,15 @@ class ModuleCloaking : public Module switch (mode) { case MODE_HALF_CLOAK: - testcloak = prefix + SegmentCloak("*", 3, 8) + suffix; + // Use old cloaking verification to stay compatible with 2.0 + // But verify domainparts when use 3.0-only features + if (domainparts == 3) + testcloak = prefix + SegmentCloak("*", 3, 8) + suffix; + else + { + irc::sockets::sockaddrs sa; + testcloak = GenCloak(sa, "", testcloak + ConvToStr(domainparts)); + } break; case MODE_OPAQUE: testcloak = prefix + SegmentCloak("*", 4, 8) + suffix; @@ -331,7 +340,10 @@ class ModuleCloaking : public Module std::string modestr = tag->getString("mode"); if (modestr == "half") + { mode = MODE_HALF_CLOAK; + domainparts = tag->getInt("domainparts", 3, 1, 10); + } else if (modestr == "full") mode = MODE_OPAQUE; else |
