summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel De Graaf <danieldg@inspircd.org>2010-03-31 11:36:38 -0500
committerDaniel De Graaf <danieldg@inspircd.org>2010-03-31 11:36:38 -0500
commit52dff8a62000bc38f05005ac0e5142a71a20b614 (patch)
treec703d59a17f2a4aad57b9331b258b68c6bece15d
parent68c55033e0d5b4dee212117bf789c58cccda078a (diff)
Remove unneeded inet_aton call
-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);