X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_dnsbl.cpp;h=2160b02dc68fcbd51a47d14b126b3ef582f74f0b;hb=c93af7582aed5f62e484550330697c634ba95f8b;hp=eb3ff976d231a9ee6e9d5b18423fe41e1774ec6c;hpb=4498f1abd163b140efcbbd9e75173665c9b1c29f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index eb3ff976d..2160b02dc 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -1,16 +1,26 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* + * InspIRCd -- Internet Relay Chat Daemon * - * InspIRCd: (C) 2002-2010 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits + * Copyright (C) 2009-2010 Daniel De Graaf + * Copyright (C) 2006-2008 Robin Burchell + * Copyright (C) 2007 Craig Edwards + * Copyright (C) 2006-2007 Dennis Friis + * Copyright (C) 2007 John Brooks * - * This program is free but copyrighted software; see - * the file COPYING for details. + * This file is part of InspIRCd. InspIRCd is free software: you can + * redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, version 2. * - * --------------------------------------------------- + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + #include "inspircd.h" #include "xline.h" @@ -340,22 +350,20 @@ class ModuleDNSBL : public Module void OnUserInit(LocalUser* user) { - /* following code taken from bopm, reverses an IP address. */ - struct in_addr in; + if (user->exempt) + return; + 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); @@ -371,6 +379,7 @@ class ModuleDNSBL : public Module bool cached; DNSBLResolver *r = new DNSBLResolver(this, nameExt, countExt, hostname, user, DNSBLConfEntries[i], cached); ServerInstance->AddResolver(r, cached); + i++; } countExt.set(user, i); }