summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp13
-rw-r--r--src/cidr.cpp3
-rw-r--r--src/command_parse.cpp3
-rw-r--r--src/commands.cpp8
-rw-r--r--src/commands/cmd_list.cpp3
-rw-r--r--src/commands/cmd_modules.cpp1
-rw-r--r--src/commands/cmd_notice.cpp3
-rw-r--r--src/commands/cmd_oper.cpp3
-rw-r--r--src/commands/cmd_privmsg.cpp3
-rw-r--r--src/commands/cmd_rehash.cpp2
-rw-r--r--src/commands/cmd_who.cpp11
-rw-r--r--src/helperfuncs.cpp1
-rw-r--r--src/modules.cpp8
-rw-r--r--src/testsuite.cpp9
-rw-r--r--src/userprocess.cpp1
-rw-r--r--src/users.cpp4
-rw-r--r--src/wildcard.cpp169
-rw-r--r--src/xline.cpp30
18 files changed, 99 insertions, 176 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 6eda54a9d..ac7c461d6 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -15,7 +15,6 @@
#include "inspircd.h"
#include <cstdarg>
-#include "wildcard.h"
#include "mode.h"
Channel::Channel(InspIRCd* Instance, const std::string &cname, time_t ts) : ServerInstance(Instance)
@@ -489,11 +488,9 @@ bool Channel::IsBanned(User* user)
snprintf(mask, MAXBUF, "%s!%s@%s", user->nick.c_str(), user->ident.c_str(), user->GetIPString());
for (BanList::iterator i = this->bans.begin(); i != this->bans.end(); i++)
{
- /* This allows CIDR ban matching
- *
- * Full masked host Full unmasked host IP with/without CIDR
- */
- if ((match(user->GetFullHost(),i->data)) || (match(user->GetFullRealHost(),i->data)) || (match(mask, i->data, true)))
+ if ((InspIRCd::Match(user->GetFullHost(),i->data, NULL)) || // host
+ (InspIRCd::Match(user->GetFullRealHost(),i->data, NULL)) || // uncloaked host
+ (InspIRCd::MatchCIDR(mask, i->data, NULL))) // ip
{
return true;
}
@@ -520,7 +517,7 @@ bool Channel::IsExtBanned(const std::string &str, char type)
std::string maskptr = i->data.substr(2);
ServerInstance->Logs->Log("EXTBANS", DEBUG, "Checking %s against %s, type is %c", str.c_str(), maskptr.c_str(), type);
- if (match(str, maskptr))
+ if (InspIRCd::Match(str, maskptr, NULL))
return true;
}
}
@@ -1038,7 +1035,7 @@ long Channel::GetMaxBans()
/* If there isnt one, we have to do some O(n) hax to find it the first time. (ick) */
for (std::map<std::string,int>::iterator n = ServerInstance->Config->maxbans.begin(); n != ServerInstance->Config->maxbans.end(); n++)
{
- if (match(this->name,n->first))
+ if (InspIRCd::Match(this->name, n->first, NULL))
{
this->maxbans = n->second;
return n->second;
diff --git a/src/cidr.cpp b/src/cidr.cpp
index fb4ab447b..91f4d0237 100644
--- a/src/cidr.cpp
+++ b/src/cidr.cpp
@@ -14,7 +14,6 @@
/* $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), NULL) &&
MatchCIDR(address.substr(username_addr_pos + 1), cidr_mask.substr(username_mask_pos + 1), false));
}
else
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 995ef694b..4063edf38 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -14,7 +14,6 @@
/* $Core */
#include "inspircd.h"
-#include "wildcard.h"
#include "xline.h"
#include "socketengine.h"
#include "socket.h"
@@ -545,7 +544,7 @@ void CommandParser::SetupCommandTable(User* user)
dirent* entry = NULL;
while (0 != (entry = readdir(library)))
{
- if (match(entry->d_name, "cmd_*.so"))
+ if (InspIRCd::Match(entry->d_name, "cmd_*.so", NULL))
{
if (!user)
{
diff --git a/src/commands.cpp b/src/commands.cpp
index a9a81f177..68ad224ae 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -14,7 +14,6 @@
/* $Core */
#include "inspircd.h"
-#include "wildcard.h"
#include "xline.h"
#include "command_parse.h"
@@ -33,7 +32,8 @@ bool InspIRCd::HostMatchesEveryone(const std::string &mask, User* user)
for (user_hash::iterator u = this->Users->clientlist->begin(); u != this->Users->clientlist->end(); u++)
{
- if ((match(u->second->MakeHost(), mask, true)) || (match(u->second->MakeHostIP(), mask, true)))
+ if ((InspIRCd::Match(u->second->MakeHost(), mask, lowermap)) ||
+ (InspIRCd::Match(u->second->MakeHostIP(), mask, lowermap)))
{
matches++;
}
@@ -64,7 +64,7 @@ bool InspIRCd::IPMatchesEveryone(const std::string &ip, User* user)
for (user_hash::iterator u = this->Users->clientlist->begin(); u != this->Users->clientlist->end(); u++)
{
- if (match(u->second->GetIPString(),ip,true))
+ if (InspIRCd::Match(u->second->GetIPString(), ip, lowermap))
matches++;
}
@@ -93,7 +93,7 @@ bool InspIRCd::NickMatchesEveryone(const std::string &nick, User* user)
for (user_hash::iterator u = this->Users->clientlist->begin(); u != this->Users->clientlist->end(); u++)
{
- if (match(u->second->nick,nick))
+ if (InspIRCd::Match(u->second->nick, nick, lowermap))
matches++;
}
diff --git a/src/commands/cmd_list.cpp b/src/commands/cmd_list.cpp
index b2ec1941b..d4abfd437 100644
--- a/src/commands/cmd_list.cpp
+++ b/src/commands/cmd_list.cpp
@@ -13,7 +13,6 @@
#include "inspircd.h"
#include "commands/cmd_list.h"
-#include "wildcard.h"
/** Handle /LIST
*/
@@ -54,7 +53,7 @@ CmdResult CommandList::Handle (const std::vector<std::string>& parameters, User
if (parameters.size() && (parameters[0][0] != '<' || parameters[0][0] == '>'))
{
- if (!match(i->second->name, parameters[0]) && !match(i->second->topic, parameters[0]))
+ if (!InspIRCd::Match(i->second->name, parameters[0], lowermap) && !InspIRCd::Match(i->second->topic, parameters[0], lowermap))
continue;
}
diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp
index 9474dece4..0b7ce2577 100644
--- a/src/commands/cmd_modules.cpp
+++ b/src/commands/cmd_modules.cpp
@@ -12,7 +12,6 @@
*/
#include "inspircd.h"
-#include "wildcard.h"
#include "commands/cmd_modules.h"
const char* itab[] = {
diff --git a/src/commands/cmd_notice.cpp b/src/commands/cmd_notice.cpp
index 9cf4800a4..37f11eeb9 100644
--- a/src/commands/cmd_notice.cpp
+++ b/src/commands/cmd_notice.cpp
@@ -12,7 +12,6 @@
*/
#include "inspircd.h"
-#include "wildcard.h"
#include "commands/cmd_notice.h"
extern "C" DllExport Command* init_command(InspIRCd* Instance)
@@ -42,7 +41,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
const char* servermask = (parameters[0].c_str()) + 1;
FOREACH_MOD(I_OnText,OnText(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, exempt_list));
- if (match(ServerInstance->Config->ServerName,servermask))
+ if (InspIRCd::Match(ServerInstance->Config->ServerName,servermask, NULL))
{
user->SendAll("NOTICE", "%s", text);
}
diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp
index 97134f038..8522890e0 100644
--- a/src/commands/cmd_oper.cpp
+++ b/src/commands/cmd_oper.cpp
@@ -12,7 +12,6 @@
*/
#include "inspircd.h"
-#include "wildcard.h"
#include "commands/cmd_oper.h"
#include "hashcomp.h"
@@ -22,7 +21,7 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
std::string xhost;
while (hl >> xhost)
{
- if (match(host, xhost) || match(ip,xhost, true))
+ if (InspIRCd::MatchCIDR(host, xhost, NULL) || InspIRCd::MatchCIDR(ip, xhost, NULL))
{
return true;
}
diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp
index 0086bb72d..135ab809e 100644
--- a/src/commands/cmd_privmsg.cpp
+++ b/src/commands/cmd_privmsg.cpp
@@ -12,7 +12,6 @@
*/
#include "inspircd.h"
-#include "wildcard.h"
#include "commands/cmd_privmsg.h"
extern "C" DllExport Command* init_command(InspIRCd* Instance)
@@ -43,7 +42,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
const char* servermask = (parameters[0].c_str()) + 1;
FOREACH_MOD(I_OnText,OnText(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list));
- if (match(ServerInstance->Config->ServerName,servermask))
+ if (InspIRCd::Match(ServerInstance->Config->ServerName, servermask, NULL))
{
user->SendAll("PRIVMSG", "%s", text);
}
diff --git a/src/commands/cmd_rehash.cpp b/src/commands/cmd_rehash.cpp
index cab593457..28ae32a0d 100644
--- a/src/commands/cmd_rehash.cpp
+++ b/src/commands/cmd_rehash.cpp
@@ -28,7 +28,7 @@ CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, Use
if (parameters.size() && parameters[0][0] != '-')
{
- if (!ServerInstance->MatchText(ServerInstance->Config->ServerName, parameters[0]))
+ if (!InspIRCd::Match(ServerInstance->Config->ServerName, parameters[0], lowermap))
{
FOREACH_MOD(I_OnRehash,OnRehash(user, parameters[0]));
return CMD_SUCCESS; // rehash for a server, and not for us
diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp
index a9f27de83..845670acf 100644
--- a/src/commands/cmd_who.cpp
+++ b/src/commands/cmd_who.cpp
@@ -12,7 +12,6 @@
*/
#include "inspircd.h"
-#include "wildcard.h"
#include "commands/cmd_who.h"
static const std::string star = "*";
@@ -75,15 +74,15 @@ bool CommandWho::whomatch(User* user, const char* matchtext)
else
{
if (opt_realname)
- realname = match(user->fullname, matchtext);
+ realname = InspIRCd::Match(user->fullname, matchtext, lowermap);
else
{
if (opt_showrealhost)
- realhost = match(user->host, matchtext);
+ realhost = InspIRCd::Match(user->host, matchtext, lowermap);
else
{
if (opt_ident)
- ident = match(user->ident, matchtext);
+ ident = InspIRCd::Match(user->ident, matchtext, lowermap);
else
{
if (opt_port)
@@ -97,13 +96,13 @@ bool CommandWho::whomatch(User* user, const char* matchtext)
else
{
if (opt_away)
- away = match(user->awaymsg, matchtext);
+ away = InspIRCd::Match(user->awaymsg, matchtext, lowermap);
}
}
}
}
}
- return ((port) || (away) || (ident) || (metadata) || (realname) || (realhost) || (match(user->dhost, matchtext)) || (match(user->nick, matchtext)) || (match(user->server, matchtext)));
+ return ((port) || (away) || (ident) || (metadata) || (realname) || (realhost) || (InspIRCd::Match(user->dhost, matchtext, lowermap)) || (InspIRCd::Match(user->nick, matchtext, lowermap)) || (InspIRCd::Match(user->server, matchtext, lowermap)));
}
}
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 31f486a48..53529f539 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -14,7 +14,6 @@
/* $Core */
#include "inspircd.h"
-#include "wildcard.h"
#include "xline.h"
#include "exitcodes.h"
diff --git a/src/modules.cpp b/src/modules.cpp
index 8061248d2..bc72f9f97 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -14,7 +14,6 @@
/* $Core */
#include "inspircd.h"
-#include "wildcard.h"
#include "xline.h"
#include "socket.h"
#include "socketengine.h"
@@ -374,7 +373,7 @@ bool ModuleManager::Load(const char* filename)
dirent* entry = NULL;
while (0 != (entry = readdir(library)))
{
- if (Instance->MatchText(entry->d_name, filename))
+ if (InspIRCd::Match(entry->d_name, filename, NULL))
{
if (!this->Load(entry->d_name))
n_match++;
@@ -729,11 +728,6 @@ Channel* InspIRCd::GetChannelIndex(long index)
return NULL;
}
-bool InspIRCd::MatchText(const std::string &sliteral, const std::string &spattern)
-{
- return match(sliteral, spattern);
-}
-
CmdResult InspIRCd::CallCommandHandler(const std::string &commandname, const std::vector<std::string>& parameters, User* user)
{
return this->Parser->CallHandler(commandname, parameters, user);
diff --git a/src/testsuite.cpp b/src/testsuite.cpp
index 9ab30ff2d..5d957e984 100644
--- a/src/testsuite.cpp
+++ b/src/testsuite.cpp
@@ -16,7 +16,6 @@
#include "inspircd.h"
#include "testsuite.h"
#include "threadengine.h"
-#include "wildcard.h"
#include <iostream>
using namespace std;
@@ -98,14 +97,14 @@ TestSuite::TestSuite(InspIRCd* Instance) : ServerInstance(Instance)
}
/* Test that x matches y with match() */
-#define WCTEST(x, y) cout << "match(\"" << x << "\",\"" << y "\") " << ((passed = (match(x, y))) ? " SUCCESS!\n" : " FAILURE\n")
+#define WCTEST(x, y) cout << "match(\"" << x << "\",\"" << y "\") " << ((passed = (InspIRCd::Match(x, y, NULL))) ? " SUCCESS!\n" : " FAILURE\n")
/* Test that x does not match y with match() */
-#define WCTESTNOT(x, y) cout << "!match(\"" << x << "\",\"" << y "\") " << ((passed = ((!match(x, y)))) ? " SUCCESS!\n" : " FAILURE\n")
+#define WCTESTNOT(x, y) cout << "!match(\"" << x << "\",\"" << y "\") " << ((passed = ((!InspIRCd::Match(x, y, NULL)))) ? " SUCCESS!\n" : " FAILURE\n")
/* Test that x matches y with match() and cidr enabled */
-#define CIDRTEST(x, y) cout << "match(\"" << x << "\",\"" << y "\", true) " << ((passed = (match(x, y, true))) ? " SUCCESS!\n" : " FAILURE\n")
+#define CIDRTEST(x, y) cout << "match(\"" << x << "\",\"" << y "\", true) " << ((passed = (InspIRCd::MatchCIDR(x, y, NULL))) ? " SUCCESS!\n" : " FAILURE\n")
/* Test that x does not match y with match() and cidr enabled */
-#define CIDRTESTNOT(x, y) cout << "!match(\"" << x << "\",\"" << y "\", true) " << ((passed = ((!match(x, y, true)))) ? " SUCCESS!\n" : " FAILURE\n")
+#define CIDRTESTNOT(x, y) cout << "!match(\"" << x << "\",\"" << y "\", true) " << ((passed = ((!InspIRCd::MatchCIDR(x, y, NULL)))) ? " SUCCESS!\n" : " FAILURE\n")
bool TestSuite::DoWildTests()
{
diff --git a/src/userprocess.cpp b/src/userprocess.cpp
index fe6a25c25..bdd7e7e8a 100644
--- a/src/userprocess.cpp
+++ b/src/userprocess.cpp
@@ -14,7 +14,6 @@
/* $Core */
#include "inspircd.h"
-#include "wildcard.h"
#include "xline.h"
#include "socketengine.h"
#include "command_parse.h"
diff --git a/src/users.cpp b/src/users.cpp
index f631420fe..943503ff1 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -16,7 +16,6 @@
#include "inspircd.h"
#include <stdarg.h>
#include "socketengine.h"
-#include "wildcard.h"
#include "xline.h"
#include "bancache.h"
#include "commands/cmd_whowas.h"
@@ -1811,7 +1810,8 @@ ConnectClass* User::SetClass(const std::string &explicit_name)
}
/* check if host matches.. */
- if (((!match(this->GetIPString(),c->GetHost(),true)) && (!match(this->host,c->GetHost()))))
+ if (!InspIRCd::MatchCIDR(this->GetIPString(), c->GetHost(), NULL) &&
+ !InspIRCd::MatchCIDR(this->host, c->GetHost(), NULL))
{
ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "No host match (for %s)", c->GetHost().c_str());
continue;
diff --git a/src/wildcard.cpp b/src/wildcard.cpp
index b230ab147..199b43965 100644
--- a/src/wildcard.cpp
+++ b/src/wildcard.cpp
@@ -17,158 +17,99 @@
#include "hashcomp.h"
#include "inspstring.h"
-using irc::sockets::MatchCIDR;
-
-/* Rewritten to operate on more effective C++ std::string types
- * rather than char* to avoid data copies.
- * - Brain
+/*
+ * Wildcard matching, the third (and probably final) iteration!
+ *
*/
-
-CoreExport bool csmatch(const std::string &str, const std::string &mask)
+static bool match_internal(const unsigned char *str, const unsigned char *mask, unsigned const char *map)
{
- std::string::const_iterator cp, mp;
-
- //unsigned char *cp = NULL, *mp = NULL;
- //unsigned char* string = (unsigned char*)str;
- //unsigned char* wild = (unsigned char*)mask;
-
- std::string::const_iterator wild = mask.begin();
- std::string::const_iterator string = str.begin();
-
- if (mask.empty())
- return false;
-
- while ((string != str.end()) && (wild != mask.end()) && (*wild != '*'))
- {
- if ((*wild != *string) && (*wild != '?'))
- return false;
-
- wild++;
- string++;
- }
-
- if (wild == mask.end() && string != str.end())
- return false;
+ const unsigned char *wild = str;
+ const unsigned char *string = mask;
+ const unsigned char *cp = NULL;
+ const unsigned char *mp = NULL;
- while (string != str.end())
+ while ((*string) && (*wild != '*'))
{
- if (wild != mask.end() && *wild == '*')
+ if (!map)
{
- if (++wild == mask.end())
- return true;
-
- mp = wild;
- cp = string;
-
- if (cp != str.end())
- cp++;
- }
- else
- if ((string != str.end() && wild != mask.end()) && ((*wild == *string) || (*wild == '?')))
- {
- wild++;
- string++;
+ if ((*wild != *string) && (*wild != '?'))
+ {
+ return false;
+ }
}
else
{
- wild = mp;
- if (cp == str.end())
- cp = str.end();
- else
- string = cp++;
+ if (map[*wild] != map[*string] && (*wild != '?'))
+ {
+ return false;
+ }
}
+ ++wild;
+ ++string;
}
- while ((wild != mask.end()) && (*wild == '*'))
- wild++;
-
- return wild == mask.end();
-}
-
-CoreExport bool match(const std::string &str, const std::string &mask)
-{
- std::string::const_iterator cp, mp;
- std::string::const_iterator wild = mask.begin();
- std::string::const_iterator string = str.begin();
-
- if (mask.empty())
- return false;
-
- while ((string != str.end()) && (wild != mask.end()) && (*wild != '*'))
- {
- if ((lowermap[(unsigned char)*wild] != lowermap[(unsigned char)*string]) && (*wild != '?'))
- return false;
-
- wild++;
- string++;
- //printf("Iterate first loop\n");
- }
-
- if (wild == mask.end() && string != str.end())
- return false;
-
- while (string != str.end())
+ while (*string)
{
- //printf("outer\n %c", *string);
- if (wild != mask.end() && *wild == '*')
+ if (*wild == '*')
{
-
- //printf("inner %c\n", *wild);
- if (++wild == mask.end())
+ if (!*++wild)
+ {
return true;
+ }
mp = wild;
- cp = string;
-
- if (cp != str.end())
- cp++;
-
+ cp = string+1;
}
- else
- if ((string != str.end() && wild != mask.end()) && ((lowermap[(unsigned char)*wild] == lowermap[(unsigned char)*string]) || (*wild == '?')))
+ // if there is no charmap and str == wild OR
+ // there is a map and mapped char == mapped wild AND
+ // wild is NOT ?
+ else if (((!map && *wild == *string) || (map && map[*wild] == map[*string])) && (*wild == '?'))
{
- if (wild != mask.end())
- wild++;
-
- if (string != str.end())
- string++;
+ ++wild;
+ ++string;
}
else
{
wild = mp;
- if (cp == str.end())
- string = str.end();
- else
- string = cp++;
+ string = cp++;
}
-
}
- while ((wild != mask.end()) && (*wild == '*'))
+ while (*wild == '*')
+ {
wild++;
+ }
- return wild == mask.end();
+ return (*wild == 0);
}
-/* Overloaded function that has the option of using cidr */
-CoreExport bool match(const std::string &str, const std::string &mask, bool use_cidr_match)
+CoreExport bool InspIRCd::Match(const std::string &str, const std::string &mask, unsigned const char *map)
{
- if (use_cidr_match && MatchCIDR(str, mask, true))
- return true;
- return match(str, mask);
+ return match_internal((const unsigned char *)str.c_str(), (const unsigned char *)mask.c_str(), map);
}
-CoreExport bool match(bool case_sensitive, const std::string &str, const std::string &mask, bool use_cidr_match)
+CoreExport bool InspIRCd::Match(const char *str, const char *mask, unsigned const char *map)
{
- if (use_cidr_match && MatchCIDR(str, mask, true))
+ return match_internal((const unsigned char *)str, (const unsigned char *)mask, map);
+}
+
+
+CoreExport bool InspIRCd::MatchCIDR(const std::string &str, const std::string &mask, unsigned const char *map)
+{
+ if (irc::sockets::MatchCIDR(str, mask, true))
return true;
- return case_sensitive ? csmatch(str, mask) : match(str, mask);
+ // Fall back to regular match
+ return InspIRCd::Match(str, mask, NULL);
}
-CoreExport bool match(bool case_sensitive, const std::string &str, const std::string &mask)
+CoreExport bool InspIRCd::MatchCIDR(const char *str, const char *mask, unsigned const char *map)
{
- return case_sensitive ? csmatch(str, mask) : match(str, mask);
+ if (irc::sockets::MatchCIDR(str, mask, true))
+ return true;
+
+ // Fall back to regular match
+ return InspIRCd::Match(str, mask, NULL);
}
diff --git a/src/xline.cpp b/src/xline.cpp
index 8843b9989..53493b59e 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -14,7 +14,6 @@
/* $Core */
#include "inspircd.h"
-#include "wildcard.h"
#include "xline.h"
#include "bancache.h"
@@ -458,9 +457,10 @@ bool KLine::Matches(User *u)
if (u->exempt)
return false;
- if ((match(u->ident, this->identmask)))
+ if (InspIRCd::Match(u->ident, this->identmask, NULL))
{
- if ((match(u->host, this->hostmask, true)) || (match(u->GetIPString(), this->hostmask, true)))
+ if (InspIRCd::MatchCIDR(u->host, this->hostmask, NULL) ||
+ InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, NULL))
{
return true;
}
@@ -479,9 +479,10 @@ bool GLine::Matches(User *u)
if (u->exempt)
return false;
- if ((match(u->ident, this->identmask)))
+ if (InspIRCd::Match(u->ident, this->identmask, NULL))
{
- if ((match(u->host, this->hostmask, true)) || (match(u->GetIPString(), this->hostmask, true)))
+ if (InspIRCd::MatchCIDR(u->host, this->hostmask, NULL) ||
+ InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, NULL))
{
return true;
}
@@ -500,9 +501,10 @@ bool ELine::Matches(User *u)
if (u->exempt)
return false;
- if ((match(u->ident, this->identmask)))
+ if (InspIRCd::Match(u->ident, this->identmask, NULL))
{
- if ((match(u->host, this->hostmask, true)) || (match(u->GetIPString(), this->hostmask, true)))
+ if (InspIRCd::MatchCIDR(u->host, this->hostmask, NULL) ||
+ InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, NULL))
{
return true;
}
@@ -516,7 +518,7 @@ bool ZLine::Matches(User *u)
if (u->exempt)
return false;
- if (match(u->GetIPString(), this->ipaddr, true))
+ if (InspIRCd::MatchCIDR(u->GetIPString(), this->ipaddr, NULL))
return true;
else
return false;
@@ -533,7 +535,7 @@ bool QLine::Matches(User *u)
if (u->exempt)
return false;
- if (match(u->nick, this->nick))
+ if (InspIRCd::Match(u->nick, this->nick, lowermap))
return true;
return false;
@@ -548,7 +550,7 @@ void QLine::Apply(User* u)
bool ZLine::Matches(const std::string &str)
{
- if (match(str, this->ipaddr, true))
+ if (InspIRCd::MatchCIDR(str, this->ipaddr, NULL))
return true;
else
return false;
@@ -556,7 +558,7 @@ bool ZLine::Matches(const std::string &str)
bool QLine::Matches(const std::string &str)
{
- if (match(str, this->nick))
+ if (InspIRCd::Match(str, this->nick, lowermap))
return true;
return false;
@@ -564,17 +566,17 @@ bool QLine::Matches(const std::string &str)
bool ELine::Matches(const std::string &str)
{
- return ((match(str, matchtext, true)));
+ return (InspIRCd::MatchCIDR(str, matchtext, NULL));
}
bool KLine::Matches(const std::string &str)
{
- return ((match(str.c_str(), matchtext, true)));
+ return (InspIRCd::MatchCIDR(str.c_str(), matchtext, NULL));
}
bool GLine::Matches(const std::string &str)
{
- return ((match(str, matchtext, true)));
+ return (InspIRCd::MatchCIDR(str, matchtext, NULL));
}
void ELine::OnAdd()