diff options
author | Adam <Adam@anope.org> | 2012-02-21 20:50:14 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-02-21 20:50:14 -0500 |
commit | 000660608eaa3be3f55333ee0c1080c72461f533 (patch) | |
tree | 99981726633964a7ad713150f461a41a2e122a8d /modules/extra | |
parent | b84e0804636d3868684c6ec2670207e7ae1cadeb (diff) |
Fixed m_dnsbl handling users with spoofs/other non ips
Diffstat (limited to 'modules/extra')
-rw-r--r-- | modules/extra/m_dnsbl.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/extra/m_dnsbl.cpp b/modules/extra/m_dnsbl.cpp index 71011760e..d4c49501c 100644 --- a/modules/extra/m_dnsbl.cpp +++ b/modules/extra/m_dnsbl.cpp @@ -135,9 +135,16 @@ class ModuleDNSBL : public Module return; /* At this time we only support IPv4 */ - sockaddrs user_ip(user->ip); - if (user_ip.sa.sa_family != AF_INET) + sockaddrs user_ip; + try + { + user_ip.pton(AF_INET, user->ip); + } + catch (const SocketException &) + { + /* User doesn't have a valid IPv4 IP (ipv6/spoof/etc) */ return; + } const unsigned long &ip = user_ip.sa4.sin_addr.s_addr; unsigned long reverse_ip = (ip << 24) | ((ip & 0xFF00) << 8) | ((ip & 0xFF0000) >> 8) | (ip >> 24); |