X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommand_parse.cpp;h=ed996e83ce3af2f73790daa6c22ae42536fb819d;hb=ce3ce6cd49e14f640a1cabfef9cf21a239dd961d;hp=66b8dcd670294b5b09803211f0623de7c2b46c9c;hpb=074727e7a74f8dcef6c250faf6a757f0274d27db;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 66b8dcd67..ed996e83c 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -40,7 +40,7 @@ bool InspIRCd::PassCompare(Extensible* ex, const std::string& data, const std::s if (!hashtype.empty() && hashtype != "plaintext") return false; - return (data == input); + return TimingSafeCompare(data, input); } bool CommandParser::LoopCall(User* user, Command* handler, const std::vector& parameters, unsigned int splithere, int extra, bool usemax) @@ -109,7 +109,7 @@ bool CommandParser::LoopCall(User* user, Command* handler, const std::vectorsecond; @@ -118,9 +118,9 @@ Command* CommandParser::GetHandler(const std::string &commandname) // calls a handler function for a command -CmdResult CommandParser::CallHandler(const std::string &commandname, const std::vector& parameters, User *user) +CmdResult CommandParser::CallHandler(const std::string& commandname, const std::vector& parameters, User* user, Command** cmd) { - Commandtable::iterator n = cmdlist.find(commandname); + CommandMap::iterator n = cmdlist.find(commandname); if (n != cmdlist.end()) { @@ -150,6 +150,8 @@ CmdResult CommandParser::CallHandler(const std::string &commandname, const std:: if (bOkay) { + if (cmd) + *cmd = n->second; return n->second->Handle(parameters,user); } } @@ -206,7 +208,7 @@ void CommandParser::ProcessCommand(LocalUser *user, std::string &cmd) { if (user->registered == REG_ALL) user->WriteNumeric(ERR_UNKNOWNCOMMAND, "%s :Unknown command",command.c_str()); - ServerInstance->stats->statsUnknown++; + ServerInstance->stats.Unknown++; return; } } @@ -279,7 +281,7 @@ void CommandParser::ProcessCommand(LocalUser *user, std::string &cmd) user->WriteNumeric(ERR_UNKNOWNCOMMAND, "%s :This command has been disabled.", command.c_str()); } - ServerInstance->SNO->WriteToSnoMask('t', "%s denied for %s (%s@%s)", + ServerInstance->SNO->WriteToSnoMask('a', "%s denied for %s (%s@%s)", command.c_str(), user->nick.c_str(), user->ident.c_str(), user->host.c_str()); return; } @@ -320,7 +322,7 @@ void CommandParser::ProcessCommand(LocalUser *user, std::string &cmd) void CommandParser::RemoveCommand(Command* x) { - Commandtable::iterator n = cmdlist.find(x->name); + CommandMap::iterator n = cmdlist.find(x->name); if (n != cmdlist.end() && n->second == x) cmdlist.erase(n); } @@ -331,7 +333,7 @@ CommandBase::~CommandBase() Command::~Command() { - ServerInstance->Parser->RemoveCommand(this); + ServerInstance->Parser.RemoveCommand(this); } void CommandParser::ProcessBuffer(std::string &buffer,LocalUser *user)