summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_dnsbl.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index d12da9dc6..c839a1311 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -343,22 +343,17 @@ class ModuleDNSBL : public Module
if (user->exempt)
return;
- /* following code taken from bopm, reverses an IP address. */
- struct in_addr in;
unsigned char a, b, c, d;
char reversedipbuf[128];
std::string reversedip;
- bool success;
- success = inet_aton(user->GetIPString(), &in);
-
- if (!success)
+ if (user->client_sa.sa.sa_family != AF_INET)
return;
- d = (unsigned char) (in.s_addr >> 24) & 0xFF;
- c = (unsigned char) (in.s_addr >> 16) & 0xFF;
- b = (unsigned char) (in.s_addr >> 8) & 0xFF;
- a = (unsigned char) in.s_addr & 0xFF;
+ d = (unsigned char) (user->client_sa.in4.sin_addr.s_addr >> 24) & 0xFF;
+ c = (unsigned char) (user->client_sa.in4.sin_addr.s_addr >> 16) & 0xFF;
+ b = (unsigned char) (user->client_sa.in4.sin_addr.s_addr >> 8) & 0xFF;
+ a = (unsigned char) user->client_sa.in4.sin_addr.s_addr & 0xFF;
snprintf(reversedipbuf, 128, "%d.%d.%d.%d", d, c, b, a);
reversedip = std::string(reversedipbuf);