aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-05-08 12:50:42 +0100
committerGravatar Sadie Powell2023-05-08 12:50:42 +0100
commitb6db18bd12cc5654f206dd40e6bf16e80cedb7e6 (patch)
treec2a4444ae643c720094d0ed702813c9cfe91eb0f /src
parentFix some uses of NULL that have snuck back in during a merge. (diff)
Move CheckPassword to helperfuncs.
Diffstat (limited to 'src')
-rw-r--r--src/command_parse.cpp20
-rw-r--r--src/helperfuncs.cpp20
2 files changed, 20 insertions, 20 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index a5edf9913..f62400dd5 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -26,26 +26,6 @@
#include "inspircd.h"
-bool InspIRCd::CheckPassword(const std::string& password, const std::string& passwordhash, const std::string& value)
-{
- ModResult res;
- FIRST_MOD_RESULT(OnCheckPassword, res, (password, passwordhash, value));
-
- if (res == MOD_RES_ALLOW)
- return true; // Password explicitly valid.
-
- if (res == MOD_RES_DENY)
- return false; // Password explicitly invalid.
-
- // The hash algorithm wasn't recognised by any modules. If its plain
- // text then we can check it internally.
- if (passwordhash.empty() || stdalgo::string::equalsci(passwordhash, "plaintext"))
- return TimingSafeCompare(password, value);
-
- // The password was invalid.
- return false;
-}
-
bool CommandParser::LoopCall(User* user, Command* handler, const CommandBase::Params& parameters, unsigned int splithere, int extra, bool usemax)
{
if (splithere >= parameters.size())
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index ba61d1b0d..4de955464 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -37,6 +37,26 @@
#include "duration.h"
#include "xline.h"
+bool InspIRCd::CheckPassword(const std::string& password, const std::string& passwordhash, const std::string& value)
+{
+ ModResult res;
+ FIRST_MOD_RESULT(OnCheckPassword, res, (password, passwordhash, value));
+
+ if (res == MOD_RES_ALLOW)
+ return true; // Password explicitly valid.
+
+ if (res == MOD_RES_DENY)
+ return false; // Password explicitly invalid.
+
+ // The hash algorithm wasn't recognised by any modules. If its plain
+ // text then we can check it internally.
+ if (passwordhash.empty() || stdalgo::string::equalsci(passwordhash, "plaintext"))
+ return TimingSafeCompare(password, value);
+
+ // The password was invalid.
+ return false;
+}
+
bool InspIRCd::IsValidMask(const std::string& mask)
{
const char* dest = mask.c_str();