summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/hashcomp.h8
-rw-r--r--include/inspircd.h8
-rw-r--r--src/cidr.cpp2
-rw-r--r--src/command_parse.cpp2
-rw-r--r--src/commands.cpp4
-rw-r--r--src/inspircd.cpp9
-rw-r--r--src/modules.cpp2
-rw-r--r--src/wildcard.cpp8
-rw-r--r--src/xline.cpp18
9 files changed, 34 insertions, 27 deletions
diff --git a/include/hashcomp.h b/include/hashcomp.h
index 46531f520..a7122c72c 100644
--- a/include/hashcomp.h
+++ b/include/hashcomp.h
@@ -54,6 +54,14 @@ unsigned const char rfc_case_insensitive_map[256] = {
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 /* 240-255 */
};
+/** Seperate from the other casemap tables so that code *can* still exclusively rely on RFC casemapping
+ * if it must.
+ *
+ * This is provided as a pointer so that modules can change it to their custom mapping tables,
+ * e.g. for national character support.
+ */
+extern unsigned const char *national_case_sensitive_map;
+
/** Case insensitive map, ASCII rules.
* That is;
* [ != {, but A == a.
diff --git a/include/inspircd.h b/include/inspircd.h
index 19674c118..85c2f62e6 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -402,14 +402,6 @@ class CoreExport InspIRCd : public classbase
*/
User* FakeClient;
- /** Seperate from the other casemap tables so that code *can* still exclusively rely on RFC casemapping
- * if it must.
- *
- * This is provided as a pointer so that modules can change it to their custom mapping tables,
- * e.g. for national character support.
- */
- static unsigned const char *national_case_sensitive_map;
-
/** Returns the next available UID for this server.
*/
std::string GetUID();
diff --git a/src/cidr.cpp b/src/cidr.cpp
index 91f4d0237..669ccd8d2 100644
--- a/src/cidr.cpp
+++ b/src/cidr.cpp
@@ -90,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 (InspIRCd::Match(address.substr(0, username_addr_pos), cidr_mask.substr(0, username_mask_pos), NULL) &&
+ 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
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 8798f03f0..eeb4b3e9f 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -578,7 +578,7 @@ void CommandParser::SetupCommandTable()
dirent* entry = NULL;
while (0 != (entry = readdir(library)))
{
- if (InspIRCd::Match(entry->d_name, "cmd_*.so"))
+ if (InspIRCd::Match(entry->d_name, "cmd_*.so", ascii_case_insensitive_map))
{
printf(".");
fflush(stdout);
diff --git a/src/commands.cpp b/src/commands.cpp
index 7efcefc6d..364f06004 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -32,8 +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 ((InspIRCd::Match(u->second->MakeHost(), mask)) ||
- (InspIRCd::Match(u->second->MakeHostIP(), mask)))
+ if ((InspIRCd::Match(u->second->MakeHost(), mask, ascii_case_insensitive_map)) ||
+ (InspIRCd::Match(u->second->MakeHostIP(), mask, ascii_case_insensitive_map)))
{
matches++;
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index dd772f94e..be88f3ae1 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -54,6 +54,14 @@
InspIRCd* SI = NULL;
int* mysig = NULL;
+/** Seperate from the other casemap tables so that code *can* still exclusively rely on RFC casemapping
+ * if it must.
+ *
+ * This is provided as a pointer so that modules can change it to their custom mapping tables,
+ * e.g. for national character support.
+ */
+unsigned const char *national_case_sensitive_map = rfc_case_insensitive_map;
+
/* Moved from exitcodes.h -- due to duplicate symbols -- Burlex
* XXX this is a bit ugly. -- w00t
@@ -985,7 +993,6 @@ void InspIRCd::SetSignal(int signal)
*/
ENTRYPOINT
{
- InspIRCd::national_case_sensitive_map = rfc_case_insensitive_map;
SI = new InspIRCd(argc, argv);
mysig = &SI->s_signal;
SI->Run();
diff --git a/src/modules.cpp b/src/modules.cpp
index 694601df9..0ea446c80 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -376,7 +376,7 @@ bool ModuleManager::Load(const char* filename)
dirent* entry = NULL;
while (0 != (entry = readdir(library)))
{
- if (InspIRCd::Match(entry->d_name, filename, NULL))
+ if (InspIRCd::Match(entry->d_name, filename, ascii_case_insensitive_map))
{
if (!this->Load(entry->d_name))
n_match++;
diff --git a/src/wildcard.cpp b/src/wildcard.cpp
index 9f91d9c68..d34430c02 100644
--- a/src/wildcard.cpp
+++ b/src/wildcard.cpp
@@ -73,7 +73,7 @@ static bool match_internal(const unsigned char *str, const unsigned char *mask,
CoreExport bool InspIRCd::Match(const std::string &str, const std::string &mask, unsigned const char *map)
{
if (!map)
- map = this->national_case_sensitive_map;
+ map = national_case_sensitive_map;
return match_internal((const unsigned char *)str.c_str(), (const unsigned char *)mask.c_str(), map);
}
@@ -81,7 +81,7 @@ CoreExport bool InspIRCd::Match(const std::string &str, const std::string &mask,
CoreExport bool InspIRCd::Match(const char *str, const char *mask, unsigned const char *map)
{
if (!map)
- map = this->national_case_sensitive_map;
+ map = national_case_sensitive_map;
return match_internal((const unsigned char *)str, (const unsigned char *)mask, map);
}
@@ -91,7 +91,7 @@ CoreExport bool InspIRCd::MatchCIDR(const std::string &str, const std::string &m
return true;
if (!map)
- map = this->national_case_sensitive_map;
+ map = national_case_sensitive_map;
// Fall back to regular match
return InspIRCd::Match(str, mask, map);
@@ -103,7 +103,7 @@ CoreExport bool InspIRCd::MatchCIDR(const char *str, const char *mask, unsigned
return true;
if (!map)
- map = this->national_case_sensitive_map;
+ map = national_case_sensitive_map;
// Fall back to regular match
return InspIRCd::Match(str, mask, map);
diff --git a/src/xline.cpp b/src/xline.cpp
index 22086375d..02560a97b 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -466,10 +466,10 @@ bool KLine::Matches(User *u)
if (u->exempt)
return false;
- if (InspIRCd::Match(u->ident, this->identmask))
+ if (InspIRCd::Match(u->ident, this->identmask, ascii_case_insensitive_map))
{
- if (InspIRCd::MatchCIDR(u->host, this->hostmask) ||
- InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask))
+ if (InspIRCd::MatchCIDR(u->host, this->hostmask, ascii_case_insensitive_map) ||
+ InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, ascii_case_insensitive_map))
{
return true;
}
@@ -488,10 +488,10 @@ bool GLine::Matches(User *u)
if (u->exempt)
return false;
- if (InspIRCd::Match(u->ident, this->identmask))
+ if (InspIRCd::Match(u->ident, this->identmask, ascii_case_insensitive_map))
{
- if (InspIRCd::MatchCIDR(u->host, this->hostmask) ||
- InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask))
+ if (InspIRCd::MatchCIDR(u->host, this->hostmask, ascii_case_insensitive_map) ||
+ InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, ascii_case_insensitive_map))
{
return true;
}
@@ -510,10 +510,10 @@ bool ELine::Matches(User *u)
if (u->exempt)
return false;
- if (InspIRCd::Match(u->ident, this->identmask))
+ if (InspIRCd::Match(u->ident, this->identmask, ascii_case_insensitive_map))
{
- if (InspIRCd::MatchCIDR(u->host, this->hostmask) ||
- InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask))
+ if (InspIRCd::MatchCIDR(u->host, this->hostmask, ascii_case_insensitive_map) ||
+ InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, ascii_case_insensitive_map))
{
return true;
}