From 1b70f3861b4b6d627e54b20d7cc7dc68a3b3d4c3 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 21 May 2008 16:30:34 +0000 Subject: Fix test suite to not have bugs itself (oops) and fix bugs in new cidr matching methods. This could do with some optimization, if you DO optimize this, test it after against the test cases: bin/inspircd --testsuite, option 5 from the menu git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9785 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/cidr.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/cidr.cpp') diff --git a/src/cidr.cpp b/src/cidr.cpp index 90654ee82..0fe7c68ca 100644 --- a/src/cidr.cpp +++ b/src/cidr.cpp @@ -100,6 +100,11 @@ bool irc::sockets::MatchCIDR(const std::string &address, const std::string &cidr cidr_copy = cidr_mask.substr(username_mask_pos + 1); } } + else + { + address_copy.assign(address); + cidr_copy.assign(cidr_mask); + } in_addr address_in4; in_addr mask_in4; @@ -109,6 +114,7 @@ bool irc::sockets::MatchCIDR(const std::string &address, const std::string &cidr if (bits_chars != std::string::npos) { bits = atoi(cidr_copy.substr(bits_chars + 1).c_str()); + cidr_copy.erase(bits_chars, cidr_copy.length() - bits_chars); } else { -- cgit v1.2.3