summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/inspircd.h2
-rw-r--r--src/command_parse.cpp4
-rw-r--r--src/commands/cmd_oper.cpp2
3 files changed, 4 insertions, 4 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index dba38d272..e729a0b2a 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -767,7 +767,7 @@ class CoreExport InspIRCd : public classbase
* @param hashtype The hash from the config file
* @return 0 if the strings match, 1 or -1 if they do not
*/
- int PassCompare(Extensible* ex, const char* data,const char* input, const char* hashtype);
+ int PassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype);
/** Check if a given server is a uline.
* An empty string returns true, this is by design.
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index e98261e58..14828cec7 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -27,7 +27,7 @@
#include <dlfcn.h>
#endif
-int InspIRCd::PassCompare(Extensible* ex, const char* data,const char* input, const char* hashtype)
+int InspIRCd::PassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype)
{
int MOD_RESULT = 0;
FOREACH_RESULT_I(this,I_OnPassCompare,OnPassCompare(ex, data, input, hashtype))
@@ -35,7 +35,7 @@ int InspIRCd::PassCompare(Extensible* ex, const char* data,const char* input, co
return 0;
if (MOD_RESULT == -1)
return 1;
- return strcmp(data,input);
+ return data != input; // this seems back to front, but returns 0 if they *match*, 1 else
}
/* LoopCall is used to call a command classes handler repeatedly based on the contents of a comma seperated list.
diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp
index dc06d87ce..1ce7dc49d 100644
--- a/src/commands/cmd_oper.cpp
+++ b/src/commands/cmd_oper.cpp
@@ -66,7 +66,7 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User
ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "hash", i, HashType, MAXBUF);
match_login = (LoginName == parameters[0]);
- match_pass = !ServerInstance->PassCompare(user, Password,parameters[1].c_str(), HashType);
+ match_pass = !ServerInstance->PassCompare(user, Password, parameters[1], HashType);
match_hosts = OneOfMatches(TheHost,TheIP,HostName);
if (match_login && match_pass && match_hosts)