There was only one case (which was probably an error) where these
methods were not set to their ServerLimits value.
17 files changed:
void SendTo(LocalUser* user);
};
void SendTo(LocalUser* user);
};
-DEFINE_HANDLER2(IsNickHandler, bool, const std::string&, size_t);
+DEFINE_HANDLER1(IsNickHandler, bool, const std::string&);
DEFINE_HANDLER2(GenRandomHandler, void, char*, size_t);
DEFINE_HANDLER1(IsIdentHandler, bool, const std::string&);
DEFINE_HANDLER2(GenRandomHandler, void, char*, size_t);
DEFINE_HANDLER1(IsIdentHandler, bool, const std::string&);
-DEFINE_HANDLER2(IsChannelHandler, bool, const std::string&, size_t);
+DEFINE_HANDLER1(IsChannelHandler, bool, const std::string&);
DEFINE_HANDLER1(RehashHandler, void, const std::string&);
DEFINE_HANDLER3(OnCheckExemptionHandler, ModResult, User*, Channel*, const std::string&);
DEFINE_HANDLER1(RehashHandler, void, const std::string&);
DEFINE_HANDLER3(OnCheckExemptionHandler, ModResult, User*, Channel*, const std::string&);
* @param chname A channel name to verify
* @return True if the name is valid
*/
* @param chname A channel name to verify
* @return True if the name is valid
*/
- caller2<bool, const std::string&, size_t> IsChannel;
+ caller1<bool, const std::string&> IsChannel;
/** Return true if str looks like a server ID
* @param string to check against
/** Return true if str looks like a server ID
* @param string to check against
* @param n A nickname to verify
* @return True if the nick is valid
*/
* @param n A nickname to verify
* @return True if the nick is valid
*/
- caller2<bool, const std::string&, size_t> IsNick;
+ caller1<bool, const std::string&> IsNick;
/** Return true if an ident is valid
* @param An ident to verify
/** Return true if an ident is valid
* @param An ident to verify
if (ServerInstance->Parser->LoopCall(user, this, parameters, 0, 1, false))
return CMD_SUCCESS;
if (ServerInstance->Parser->LoopCall(user, this, parameters, 0, 1, false))
return CMD_SUCCESS;
- if (ServerInstance->IsChannel(parameters[0], ServerInstance->Config->Limits.ChanMax))
+ if (ServerInstance->IsChannel(parameters[0]))
{
Channel::JoinUser(user, parameters[0], false, parameters[1]);
return CMD_SUCCESS;
{
Channel::JoinUser(user, parameters[0], false, parameters[1]);
return CMD_SUCCESS;
if (ServerInstance->Parser->LoopCall(user, this, parameters, 0, -1, false))
return CMD_SUCCESS;
if (ServerInstance->Parser->LoopCall(user, this, parameters, 0, -1, false))
return CMD_SUCCESS;
- if (ServerInstance->IsChannel(parameters[0], ServerInstance->Config->Limits.ChanMax))
+ if (ServerInstance->IsChannel(parameters[0]))
{
Channel::JoinUser(user, parameters[0]);
return CMD_SUCCESS;
{
Channel::JoinUser(user, parameters[0]);
return CMD_SUCCESS;
{
newnick = user->uuid;
}
{
newnick = user->uuid;
}
- else if (!ServerInstance->IsNick(newnick, ServerInstance->Config->Limits.NickMax))
+ else if (!ServerInstance->IsNick(newnick))
{
user->WriteNumeric(432, "%s %s :Erroneous Nickname", user->nick.c_str(),newnick.c_str());
return CMD_FAILURE;
{
user->WriteNumeric(432, "%s %s :Erroneous Nickname", user->nick.c_str(),newnick.c_str());
return CMD_FAILURE;
}
/* true for valid channel name, false else */
}
/* true for valid channel name, false else */
-bool IsChannelHandler::Call(const std::string& chname, size_t max)
+bool IsChannelHandler::Call(const std::string& chname)
- if (chname.empty() || chname.length() > max)
+ if (chname.empty() || chname.length() > ServerInstance->Config->Limits.ChanMax)
return false;
if (chname[0] != '#')
return false;
if (chname[0] != '#')
}
/* true for valid nickname, false else */
}
/* true for valid nickname, false else */
-bool IsNickHandler::Call(const std::string& n, size_t max)
+bool IsNickHandler::Call(const std::string& n)
- if (n.empty() || n.length() > max)
+ if (n.empty() || n.length() > ServerInstance->Config->Limits.NickMax)
return false;
for (std::string::const_iterator i = n.begin(); i != n.end(); ++i)
return false;
for (std::string::const_iterator i = n.begin(); i != n.end(); ++i)
{
if (adding && IS_LOCAL(source))
{
{
if (adding && IS_LOCAL(source))
{
- if (!ServerInstance->IsChannel(mask[CHAN].c_str(), ServerInstance->Config->Limits.ChanMax))
+ if (!ServerInstance->IsChannel(mask[CHAN]))
{
source->WriteNumeric(403, "%s %s :Invalid channel name in redirection (%s)", source->nick.c_str(), channel->name.c_str(), mask[CHAN].c_str());
return false;
{
source->WriteNumeric(403, "%s %s :Invalid channel name in redirection (%s)", source->nick.c_str(), channel->name.c_str(), mask[CHAN].c_str());
return false;
static std::bitset<256> allowedmap;
static std::bitset<256> allowedmap;
-class NewIsChannelHandler : public HandlerBase2<bool, const std::string&, size_t>
+class NewIsChannelHandler : public HandlerBase1<bool, const std::string&>
{
public:
NewIsChannelHandler() { }
~NewIsChannelHandler() { }
{
public:
NewIsChannelHandler() { }
~NewIsChannelHandler() { }
- bool Call(const std::string&, size_t);
+ bool Call(const std::string&);
-bool NewIsChannelHandler::Call(const std::string& channame, size_t max)
+bool NewIsChannelHandler::Call(const std::string& channame)
- if (channame.empty() || channame.length() > max || channame[0] != '#')
+ if (channame.empty() || channame.length() > ServerInstance->Config->Limits.ChanMax || channame[0] != '#')
return false;
for (std::string::const_iterator c = channame.begin(); c != channame.end(); ++c)
return false;
for (std::string::const_iterator c = channame.begin(); c != channame.end(); ++c)
class ModuleChannelNames : public Module
{
NewIsChannelHandler myhandler;
class ModuleChannelNames : public Module
{
NewIsChannelHandler myhandler;
- caller2<bool, const std::string&, size_t> rememberer;
+ caller1<bool, const std::string&> rememberer;
std::vector<Channel*> chanvec;
for (chan_hash::const_iterator i = ServerInstance->chanlist->begin(); i != ServerInstance->chanlist->end(); ++i)
{
std::vector<Channel*> chanvec;
for (chan_hash::const_iterator i = ServerInstance->chanlist->begin(); i != ServerInstance->chanlist->end(); ++i)
{
- if (!ServerInstance->IsChannel(i->second->name, MAXBUF))
+ if (!ServerInstance->IsChannel(i->second->name))
chanvec.push_back(i->second);
}
std::vector<Channel*>::reverse_iterator c2 = chanvec.rbegin();
chanvec.push_back(i->second);
}
std::vector<Channel*>::reverse_iterator c2 = chanvec.rbegin();
while (chans.GetToken(chan))
{
while (chans.GetToken(chan))
{
- if (ServerInstance->IsChannel(chan, ServerInstance->Config->Limits.ChanMax))
+ if (ServerInstance->IsChannel(chan))
Channel::JoinUser(localuser, chan);
}
}
Channel::JoinUser(localuser, chan);
}
}
- if (!ServerInstance->IsChannel(redirect, ServerInstance->Config->Limits.ChanMax))
+ if (!ServerInstance->IsChannel(redirect))
{
if (user)
user->WriteNotice("Invalid badchan redirect '" + redirect + "'");
{
if (user)
user->WriteNotice("Invalid badchan redirect '" + redirect + "'");
- if (ServerInstance->IsChannel(redirect.c_str(), ServerInstance->Config->Limits.ChanMax))
+ if (ServerInstance->IsChannel(redirect))
{
/* simple way to avoid potential loops: don't redirect to +L channels */
Channel *newchan = ServerInstance->FindChan(redirect);
{
/* simple way to avoid potential loops: don't redirect to +L channels */
Channel *newchan = ServerInstance->FindChan(redirect);
/* $ModDesc: Provides an ability to have non-RFC1459 nicks & support for national CASEMAPPING */
/* $ModDesc: Provides an ability to have non-RFC1459 nicks & support for national CASEMAPPING */
-class lwbNickHandler : public HandlerBase2<bool, const std::string&, size_t>
+class lwbNickHandler : public HandlerBase1<bool, const std::string&>
{
public:
lwbNickHandler() { }
~lwbNickHandler() { }
{
public:
lwbNickHandler() { }
~lwbNickHandler() { }
- bool Call(const std::string&, size_t);
+ bool Call(const std::string&);
};
/*,m_reverse_additionalUp[256];*/
};
/*,m_reverse_additionalUp[256];*/
-bool lwbNickHandler::Call(const std::string& nick, size_t max)
+bool lwbNickHandler::Call(const std::string& nick)
{
if (nick.empty())
return false;
{
if (nick.empty())
return false;
}
/* too long? or not -- pointer arithmetic rocks */
}
/* too long? or not -- pointer arithmetic rocks */
+ return (p < ServerInstance->Config->Limits.NickMax);
lwbNickHandler myhandler;
std::string charset, casemapping;
unsigned char m_additional[256], m_additionalUp[256], m_lower[256], m_upper[256];
lwbNickHandler myhandler;
std::string charset, casemapping;
unsigned char m_additional[256], m_additionalUp[256], m_lower[256], m_upper[256];
- caller2<bool, const std::string&, size_t> rememberer;
+ caller1<bool, const std::string&> rememberer;
bool forcequit;
const unsigned char * lowermap_rememberer;
bool forcequit;
const unsigned char * lowermap_rememberer;
{
/* Fix by Brain: Dont quit UID users */
User* n = *iter;
{
/* Fix by Brain: Dont quit UID users */
User* n = *iter;
- if (!isdigit(n->nick[0]) && !ServerInstance->IsNick(n->nick, ServerInstance->Config->Limits.NickMax))
+ if (!isdigit(n->nick[0]) && !ServerInstance->IsNick(n->nick))
ServerInstance->Users->QuitUser(n, message);
}
}
ServerInstance->Users->QuitUser(n, message);
}
}
/* Do local sanity checks and bails */
if (IS_LOCAL(user))
{
/* Do local sanity checks and bails */
if (IS_LOCAL(user))
{
- if (!ServerInstance->IsNick(parameters[1], ServerInstance->Config->Limits.NickMax))
+ if (!ServerInstance->IsNick(parameters[1]))
{
user->WriteNotice("*** Invalid nickname '" + parameters[1] + "'");
return CMD_FAILURE;
{
user->WriteNotice("*** Invalid nickname '" + parameters[1] + "'");
return CMD_FAILURE;
CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user)
{
// Make sure the channel name is allowable.
CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user)
{
// Make sure the channel name is allowable.
- if (!ServerInstance->IsChannel(parameters[0], ServerInstance->Config->Limits.ChanMax))
+ if (!ServerInstance->IsChannel(parameters[0]))
{
user->WriteNotice("*** Invalid characters in channel name or name too long");
return CMD_FAILURE;
{
user->WriteNotice("*** Invalid characters in channel name or name too long");
return CMD_FAILURE;
return;
for (std::vector<std::string>::const_iterator i = operChans.begin(); i != operChans.end(); ++i)
return;
for (std::vector<std::string>::const_iterator i = operChans.begin(); i != operChans.end(); ++i)
- if (ServerInstance->IsChannel(*i, ServerInstance->Config->Limits.ChanMax))
+ if (ServerInstance->IsChannel(*i))
Channel::JoinUser(localuser, *i, override);
std::string chanList = localuser->oper->getConfig("autojoin");
Channel::JoinUser(localuser, *i, override);
std::string chanList = localuser->oper->getConfig("autojoin");
tokenize(chanList, typechans);
for (std::vector<std::string>::const_iterator it = typechans.begin(); it != typechans.end(); ++it)
{
tokenize(chanList, typechans);
for (std::vector<std::string>::const_iterator it = typechans.begin(); it != typechans.end(); ++it)
{
- if (ServerInstance->IsChannel(*it, ServerInstance->Config->Limits.ChanMax))
+ if (ServerInstance->IsChannel(*it))
{
Channel::JoinUser(localuser, *it, override);
}
{
Channel::JoinUser(localuser, *it, override);
}
{
if (IS_LOCAL(source))
{
{
if (IS_LOCAL(source))
{
- if (!ServerInstance->IsChannel(parameter, ServerInstance->Config->Limits.ChanMax))
+ if (!ServerInstance->IsChannel(parameter))
{
source->WriteNumeric(403, "%s %s :Invalid channel name", source->nick.c_str(), parameter.c_str());
parameter.clear();
{
source->WriteNumeric(403, "%s %s :Invalid channel name", source->nick.c_str(), parameter.c_str());
parameter.clear();
user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str());
return CMD_FAILURE;
}
user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str());
return CMD_FAILURE;
}
- if (IS_LOCAL(user) && !ServerInstance->IsChannel(parameters[1].c_str(), ServerInstance->Config->Limits.ChanMax))
+ if (IS_LOCAL(user) && !ServerInstance->IsChannel(parameters[1]))
{
/* we didn't need to check this for each character ;) */
user->WriteNotice("*** Invalid characters in channel name or name too long");
{
/* we didn't need to check this for each character ;) */
user->WriteNotice("*** Invalid characters in channel name or name too long");
- if (!ServerInstance->IsNick(parameters[1], ServerInstance->Config->Limits.NickMax))
+ if (!ServerInstance->IsNick(parameters[1]))
{
user->WriteNotice("*** Invalid nickname '" + parameters[1] + "'");
return CMD_FAILURE;
{
user->WriteNotice("*** Invalid nickname '" + parameters[1] + "'");
return CMD_FAILURE;
CmdResult CommandSVSJoin::Handle(const std::vector<std::string>& parameters, User *user)
{
// Check for valid channel name
CmdResult CommandSVSJoin::Handle(const std::vector<std::string>& parameters, User *user)
{
// Check for valid channel name
- if (!ServerInstance->IsChannel(parameters[1].c_str(), ServerInstance->Config->Limits.ChanMax))
+ if (!ServerInstance->IsChannel(parameters[1]))
return CMD_FAILURE;
// Check target exists
return CMD_FAILURE;
// Check target exists
CmdResult remove_watch(User* user, const char* nick)
{
// removing an item from the list
CmdResult remove_watch(User* user, const char* nick)
{
// removing an item from the list
- if (!ServerInstance->IsNick(nick, ServerInstance->Config->Limits.NickMax))
+ if (!ServerInstance->IsNick(nick))
{
user->WriteNumeric(942, "%s %s :Invalid nickname", user->nick.c_str(), nick);
return CMD_FAILURE;
{
user->WriteNumeric(942, "%s %s :Invalid nickname", user->nick.c_str(), nick);
return CMD_FAILURE;
CmdResult add_watch(User* user, const char* nick)
{
CmdResult add_watch(User* user, const char* nick)
{
- if (!ServerInstance->IsNick(nick, ServerInstance->Config->Limits.NickMax))
+ if (!ServerInstance->IsNick(nick))
{
user->WriteNumeric(942, "%s %s :Invalid nickname",user->nick.c_str(),nick);
return CMD_FAILURE;
{
user->WriteNumeric(942, "%s %s :Invalid nickname",user->nick.c_str(),nick);
return CMD_FAILURE;