]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cidr.cpp
Replace hardcoded mode letters, part 3
[user/henk/code/inspircd.git] / src / cidr.cpp
index 535930026636007f65f48bd366a57ef06a281e33..f5ecaac5b7e88dde8aef3a7583f80ba0a0a691ac 100644 (file)
@@ -1,17 +1,23 @@
-/*       +------------------------------------+
- *       | 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 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2008 Craig Edwards <craigedwards@brainbox.cc>
+ *   Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
  *
- * 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 <http://www.gnu.org/licenses/>.
  */
 
-/* $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,6 @@ bool irc::sockets::MatchCIDR(const std::string &address, const std::string &cidr
        irc::sockets::cidr_mask mask2(addr, mask.length);
 
        return mask == mask2;
-
 }