summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-03 18:38:31 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-03 18:38:31 +0000
commit66da4ef77e9d22370ebfbab014abe5acefce35f4 (patch)
tree22f7018b41b07e6abd6b08614c9e5790ef560efe /src
parentccbf18ec4b8f49a40f21a1db32a3923322e5ed53 (diff)
On ipv6 servers, if a user connects with 4in6 (0::ffff:...) then attempt a dnsbl lookup of their ip (the bit after the 0::ffff:)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6484 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_dnsbl.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index 213c2f67e..6ea05e6fa 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -270,13 +270,30 @@ class ModuleDNSBL : public Module
unsigned char a, b, c, d;
char reversedipbuf[128];
std::string reversedip;
+ bool success = false;
if (!inet_aton(user->GetIPString(), &in))
{
- ServerInstance->WriteOpers("Invalid IP address in m_dnsbl! Bailing check");
- return 0;
+#ifdef IPV6
+ /* We could have an ipv6 address here */
+ std::string x = user->GetIPString();
+ /* Is it a 4in6 address? (Compensate for this kernel kludge that people love) */
+ if (x.find("0::ffff:") == x.begin())
+ {
+ x.erase(x.begin(), x.begin() + 8);
+ if (inet_aton(x.c_str(), &in))
+ success = true;
+ }
+#endif
+ }
+ else
+ {
+ success = true;
}
+ if (!success)
+ return 0;
+
d = (unsigned char) (in.s_addr >> 24) & 0xFF;
c = (unsigned char) (in.s_addr >> 16) & 0xFF;
b = (unsigned char) (in.s_addr >> 8) & 0xFF;
@@ -289,7 +306,7 @@ class ModuleDNSBL : public Module
for (std::vector<DNSBLConfEntry *>::iterator i = DNSBLConfEntries.begin(); i != DNSBLConfEntries.end(); i++)
{
// Fill hostname with a dnsbl style host (d.c.b.a.domain.tld)
- std::string hostname=reversedip+"."+ (*i)->domain;
+ std::string hostname = reversedip + "." + (*i)->domain;
/* now we'd need to fire off lookups for `hostname'. */
bool cached;