From 52dff8a62000bc38f05005ac0e5142a71a20b614 Mon Sep 17 00:00:00 2001 From: Daniel De Graaf Date: Wed, 31 Mar 2010 11:36:38 -0500 Subject: Remove unneeded inet_aton call --- src/modules/m_dnsbl.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/modules/m_dnsbl.cpp') 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); -- cgit v1.2.3