diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/command_parse.cpp | 11 | ||||
-rw-r--r-- | src/commands/cmd_die.cpp | 2 | ||||
-rw-r--r-- | src/commands/cmd_oper.cpp | 2 | ||||
-rw-r--r-- | src/commands/cmd_restart.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_customtitle.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_vhost.cpp | 2 | ||||
-rw-r--r-- | src/users.cpp | 2 |
7 files changed, 11 insertions, 12 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 20977995b..66b8dcd67 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -23,25 +23,24 @@ #include "inspircd.h" -int InspIRCd::PassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype) +bool InspIRCd::PassCompare(Extensible* ex, const std::string& data, const std::string& input, const std::string& hashtype) { ModResult res; FIRST_MOD_RESULT(OnPassCompare, res, (ex, data, input, hashtype)); /* Module matched */ if (res == MOD_RES_ALLOW) - return 0; + return true; /* Module explicitly didnt match */ if (res == MOD_RES_DENY) - return 1; + return false; /* We dont handle any hash types except for plaintext - Thanks tra26 */ if (!hashtype.empty() && hashtype != "plaintext") - /* See below. 1 because they dont match */ - return 1; + return false; - return (data != input); // this seems back to front, but returns 0 if they *match*, 1 else + return (data == input); } bool CommandParser::LoopCall(User* user, Command* handler, const std::vector<std::string>& parameters, unsigned int splithere, int extra, bool usemax) diff --git a/src/commands/cmd_die.cpp b/src/commands/cmd_die.cpp index 3ccc037b4..105f40d46 100644 --- a/src/commands/cmd_die.cpp +++ b/src/commands/cmd_die.cpp @@ -46,7 +46,7 @@ class CommandDie : public Command */ CmdResult CommandDie::Handle (const std::vector<std::string>& parameters, User *user) { - if (!ServerInstance->PassCompare(user, ServerInstance->Config->diepass, parameters[0].c_str(), ServerInstance->Config->powerhash)) + if (ServerInstance->PassCompare(user, ServerInstance->Config->diepass, parameters[0].c_str(), ServerInstance->Config->powerhash)) { { std::string diebuf = "*** DIE command from " + user->GetFullHost() + ". Terminating."; diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp index 5094fae22..a70c93dd1 100644 --- a/src/commands/cmd_oper.cpp +++ b/src/commands/cmd_oper.cpp @@ -56,7 +56,7 @@ CmdResult CommandOper::HandleLocal(const std::vector<std::string>& parameters, L OperInfo* ifo = i->second; ConfigTag* tag = ifo->oper_block; match_login = true; - match_pass = !ServerInstance->PassCompare(user, tag->getString("password"), parameters[1], tag->getString("hash")); + match_pass = ServerInstance->PassCompare(user, tag->getString("password"), parameters[1], tag->getString("hash")); match_hosts = InspIRCd::MatchMask(tag->getString("host"), userHost, userIP); if (match_pass && match_hosts) diff --git a/src/commands/cmd_restart.cpp b/src/commands/cmd_restart.cpp index 6711ada7d..be711e069 100644 --- a/src/commands/cmd_restart.cpp +++ b/src/commands/cmd_restart.cpp @@ -40,7 +40,7 @@ class CommandRestart : public Command CmdResult CommandRestart::Handle (const std::vector<std::string>& parameters, User *user) { ServerInstance->Logs->Log("COMMAND", LOG_DEFAULT, "Restart: %s",user->nick.c_str()); - if (!ServerInstance->PassCompare(user, ServerInstance->Config->restartpass, parameters[0].c_str(), ServerInstance->Config->powerhash)) + if (ServerInstance->PassCompare(user, ServerInstance->Config->restartpass, parameters[0].c_str(), ServerInstance->Config->powerhash)) { ServerInstance->SNO->WriteGlobalSno('a', "RESTART command from %s, restarting server.", user->GetFullRealHost().c_str()); diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 015353086..b0c9fad21 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -48,7 +48,7 @@ class CommandTitle : public Command std::string title = i->second->getString("title"); std::string vhost = i->second->getString("vhost"); - if (Name == parameters[0] && !ServerInstance->PassCompare(user, pass, parameters[1], hash) && + if (Name == parameters[0] && ServerInstance->PassCompare(user, pass, parameters[1], hash) && InspIRCd::MatchMask(host, userHost, userIP) && !title.empty()) { ctitle.set(user, title); diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 2e25849ae..227d9426e 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -43,7 +43,7 @@ class CommandVhost : public Command std::string pass = tag->getString("pass"); std::string hash = tag->getString("hash"); - if (parameters[0] == username && !ServerInstance->PassCompare(user, pass, parameters[1], hash)) + if (parameters[0] == username && ServerInstance->PassCompare(user, pass, parameters[1], hash)) { if (!mask.empty()) { diff --git a/src/users.cpp b/src/users.cpp index 2458e1565..4968c7a37 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1239,7 +1239,7 @@ void LocalUser::SetClass(const std::string &explicit_name) if (regdone && !c->config->getString("password").empty()) { - if (ServerInstance->PassCompare(this, c->config->getString("password"), password, c->config->getString("hash"))) + if (!ServerInstance->PassCompare(this, c->config->getString("password"), password, c->config->getString("hash"))) { ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Bad password, skipping"); continue; |