X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcidr.cpp;h=669ccd8d27f6df9fd685c1b29728f407c4ea2460;hb=9ab8bbe92ee7d8242e958b20abb3bc7b830bcfb0;hp=90654ee820e70da4a5d95c27bd4c8dc00868cb49;hpb=03ef675c0dd4742464d8ad93888e98721a044108;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/cidr.cpp b/src/cidr.cpp index 90654ee82..669ccd8d2 100644 --- a/src/cidr.cpp +++ b/src/cidr.cpp @@ -11,10 +11,9 @@ * --------------------------------------------------- */ -/* $Core: libIRCDcidr */ +/* $Core */ #include "inspircd.h" -#include "wildcard.h" /* Used when comparing CIDR masks for the modulus bits left over. * A lot of ircd's seem to do this: @@ -91,7 +90,7 @@ bool irc::sockets::MatchCIDR(const std::string &address, const std::string &cidr * symbols, and recursively call MatchCIDR without * username matching enabled to match the host part. */ - return (match(address.substr(0, username_addr_pos), cidr_mask.substr(0, username_mask_pos)) && + return (InspIRCd::Match(address.substr(0, username_addr_pos), cidr_mask.substr(0, username_mask_pos), ascii_case_insensitive_map) && MatchCIDR(address.substr(username_addr_pos + 1), cidr_mask.substr(username_mask_pos + 1), false)); } else @@ -100,6 +99,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 +113,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 {