diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-04 19:34:41 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-04 19:34:41 +0000 |
commit | b84c73fbfdbc483093f961c0e9647e9581f2dbde (patch) | |
tree | d0b133889f6d4fd2ff8b1485f409b8a063d2703b /src/modules | |
parent | 1bbaa4664b2531a66029187aa1ef5a0ff62c061d (diff) |
Fix it good :p
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5846 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_cloaking.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index bddf65eea..0f33df585 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -365,7 +365,6 @@ class CloakUser : public ModeHandler std::string Cloak4(const char* ip) { - std::string b; irc::sepstream seps(ip, '.'); char ra1[64], ra2[64], ra3[64], ra4[64]; int i1, i2, i3, i4; @@ -377,19 +376,34 @@ class CloakUser : public ModeHandler i2 = atoi(octet2.c_str()); i3 = atoi(octet3.c_str()); i4 = atoi(octet4.c_str()); - octet1.append(".").append(octet2).append(".").append(octet3); - octet2.append(".").append(octet3); - ServerInstance->Log(DEBUG,"oct1=%s, oct2=%s, oct3=%s, oct4=%s", octet1.c_str(), octet2.c_str(), octet3.c_str(), octet4.c_str()); + octet4 = octet1 + "." + octet2 + "." + octet3 + "." + octet4; + octet3 = octet1 + "." + octet2 + "." + octet3; + octet2 = octet1 + "." + octet2; this->GenHash(octet1.c_str(),ra1, (key1+i1) % 4); this->GenHash(octet2.c_str(),ra2, (key2+i2) % 4); this->GenHash(octet3.c_str(),ra3, (key3+i3) % 4); this->GenHash(octet4.c_str(),ra4, (key4+i4) % 4); - ServerInstance->Log(DEBUG,"ra1=%s, ra2=%s, ra3=%s, ra4=%s", ra1, ra2, ra3, ra4); /* This is safe as we know the length generated by our genhash is always 16 */ ra1[8] = ra2[8] = ra3[8] = ra4[8] = 0; - b.append(ra1).append(".").append(ra2).append(".").append(ra3).append(".").append(ra4); - return b; + return std::string().append(ra1).append(".").append(ra2).append(".").append(ra3).append(".").append(ra4); } + + /* XXX: Uncomment and call to use the test suite for ipv4 cloaking + void C4TestSuite() + { + printf("%s %s\n", "192.168.1.1", cu->Cloak4("192.168.1.1").c_str()); + printf("%s %s\n", "192.168.1.2", cu->Cloak4("192.168.1.2").c_str()); + printf("%s %s\n", "192.168.10.1", cu->Cloak4("192.168.10.1").c_str()); + printf("%s %s\n", "192.168.10.1", cu->Cloak4("192.168.10.2").c_str()); + printf("%s %s\n", "192.169.1.1", cu->Cloak4("192.169.1.1").c_str()); + printf("%s %s\n", "192.169.2.1", cu->Cloak4("192.169.2.1").c_str()); + printf("%s %s\n", "200.168.1.1", cu->Cloak4("200.168.1.1").c_str()); + printf("%s %s\n", "200.168.1.3", cu->Cloak4("200.168.1.3").c_str()); + printf("%s %s\n", "200.168.3.3", cu->Cloak4("200.168.3.3").c_str()); + printf("%s %s\n", "200.169.4.3", cu->Cloak4("200.169.4.3").c_str()); + exit(0); + } + */ void DoRehash() { |