X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcidr.cpp;h=d6370b06a32264edb6fba4a9ff0cf0648b1ac732;hb=adb26a4e882d317de4e4135f414b7002cafe07a4;hp=31101836c930375484df444e007d7545910fb25f;hpb=9fad3ecb9215a0034bf407f192926b04cb5efaed;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/cidr.cpp b/src/cidr.cpp index 31101836c..d6370b06a 100644 --- a/src/cidr.cpp +++ b/src/cidr.cpp @@ -1,17 +1,23 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* + * InspIRCd -- Internet Relay Chat Daemon * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits + * Copyright (C) 2009 Daniel De Graaf + * Copyright (C) 2008 Craig Edwards + * Copyright (C) 2008 Robin Burchell * - * 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 . */ -/* $Core */ #include "inspircd.h" @@ -75,6 +81,9 @@ bool irc::sockets::MatchCIDR(const std::string &address, const std::string &cidr cidr_copy.assign(cidr_mask); } + if (cidr_copy.find('/') == std::string::npos) + return false; + irc::sockets::sockaddrs addr; irc::sockets::aptosa(address_copy, 0, addr); @@ -82,7 +91,4 @@ bool irc::sockets::MatchCIDR(const std::string &address, const std::string &cidr irc::sockets::cidr_mask mask2(addr, mask.length); return mask == mask2; - } - -