summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-05 19:50:10 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-05 19:50:10 +0000
commit8f385c300681b8872cd0a76054970a3086178823 (patch)
tree300a4136c9302b900c8a89783b8f9efc07c060e1
parent2ade6284f9044792177664214e7097e23eccd280 (diff)
This has changed again, i suggest you dont bother trying to keep up till im done :p
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5863 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/inspircd.h3
-rw-r--r--src/commands.cpp6
-rw-r--r--src/modules/extra/m_ssl_oper_cert.cpp2
-rw-r--r--src/modules/m_oper_hash.cpp24
4 files changed, 18 insertions, 17 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index d0806a381..f0f5a1d1f 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -945,9 +945,10 @@ class InspIRCd : public classbase
* against possible hashed equivalents in the input string.
* @param data The data from the config file
* @param input The data input by the oper
+ * @param tagnum the tag number of the oper's tag in the config file
* @return 0 if the strings match, 1 or -1 if they do not
*/
- int OperPassCompare(const char* data,const char* input);
+ int OperPassCompare(const char* data,const char* input, int tagnum);
/** Check if a given server is a uline.
* An empty string returns true, this is by design.
diff --git a/src/commands.cpp b/src/commands.cpp
index 581dde34b..60e7c98dc 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -32,16 +32,14 @@ bool InspIRCd::ULine(const char* server)
return (find(Config->ulines.begin(),Config->ulines.end(),server) != Config->ulines.end());
}
-int InspIRCd::OperPassCompare(const char* data,const char* input)
+int InspIRCd::OperPassCompare(const char* data,const char* input, int tagnum)
{
int MOD_RESULT = 0;
- FOREACH_RESULT_I(this,I_OnOperCompare,OnOperCompare(data,input))
- Log(DEBUG,"OperPassCompare: %d",MOD_RESULT);
+ FOREACH_RESULT_I(this,I_OnOperCompare,OnOperCompare(data, input, tagnum))
if (MOD_RESULT == 1)
return 0;
if (MOD_RESULT == -1)
return 1;
- Log(DEBUG,"strcmp fallback: '%s' '%s' %d",data,input,strcmp(data,input));
return strcmp(data,input);
}
diff --git a/src/modules/extra/m_ssl_oper_cert.cpp b/src/modules/extra/m_ssl_oper_cert.cpp
index f5bcae090..d638ad318 100644
--- a/src/modules/extra/m_ssl_oper_cert.cpp
+++ b/src/modules/extra/m_ssl_oper_cert.cpp
@@ -143,7 +143,7 @@ class ModuleOperSSLCert : public Module
if (*FingerPrint)
{
- if ((!strcmp(LoginName,parameters[0])) && (!ServerInstance->OperPassCompare(Password,parameters[1])) && (OneOfMatches(TheHost,TheIP,HostName)))
+ if ((!strcmp(LoginName,parameters[0])) && (!ServerInstance->OperPassCompare(Password,parameters[1], i)) && (OneOfMatches(TheHost,TheIP,HostName)))
{
/* This oper would match */
if ((!cert) || (cert->GetFingerprint() != FingerPrint))
diff --git a/src/modules/m_oper_hash.cpp b/src/modules/m_oper_hash.cpp
index e38aee57a..d74939a5d 100644
--- a/src/modules/m_oper_hash.cpp
+++ b/src/modules/m_oper_hash.cpp
@@ -56,8 +56,8 @@ class cmd_mkpasswd : public command_t
{
if ((Prov & PROV_MD5) > 0)
{
- MD5ResetRequest(Sender, Provider).Send();
- user->WriteServ("NOTICE %s :MD5 hashed password for %s is %s",user->nick, parameters[1], MD5SumRequest(Sender, Provider, parameters[1]).Send() );
+ MD5ResetRequest(Sender, MD5Provider).Send();
+ user->WriteServ("NOTICE %s :MD5 hashed password for %s is %s",user->nick, parameters[1], MD5SumRequest(Sender, MD5Provider, parameters[1]).Send() );
}
else
{
@@ -68,8 +68,8 @@ class cmd_mkpasswd : public command_t
{
if ((Prov & PROV_SHA) > 0)
{
- SHA256ResetRequest(Sender, Provider).Send();
- user->WriteServ("NOTICE %s :SHA256 hashed password for %s is %s",user->nick, parameters[1], SHA256SumRequest(Sender, Provider, parameters[1]).Send() );
+ SHA256ResetRequest(Sender, SHAProvider).Send();
+ user->WriteServ("NOTICE %s :SHA256 hashed password for %s is %s",user->nick, parameters[1], SHA256SumRequest(Sender, SHAProvider, parameters[1]).Send() );
}
else
{
@@ -78,7 +78,7 @@ class cmd_mkpasswd : public command_t
}
else
{
- user->WriteServ("NOTICE %s :Unknown hash type, valid hash types are 'sha256' and 'md5'");
+ user->WriteServ("NOTICE %s :Unknown hash type, valid hash types are:%s%s", (Prov & PROV_MD5) > 0 ? " MD5" : "", (Prov & PROV_SHA) > 0 ? " SHA256" : "");
}
/* NOTE: Don't propogate this across the network!
@@ -93,7 +93,8 @@ class ModuleOperHash : public Module
{
cmd_mkpasswd* mycommand;
- Module* MD5Provider, SHAProvider;
+ Module* MD5Provider;
+ Module* SHAProvider;
std::string providername;
int ID;
ConfigReader* Conf;
@@ -101,8 +102,9 @@ class ModuleOperHash : public Module
public:
ModuleOperHash(InspIRCd* Me)
- : Module::Module(Me), Conf(NULL)
+ : Module::Module(Me)
{
+ Conf = NULL;
OnRehash("");
/* Try to find the md5 service provider, bail if it can't be found */
@@ -140,15 +142,15 @@ class ModuleOperHash : public Module
std::string hashtype = Conf->ReadValue("oper", "hash", tagnumber);
if ((hashtype == "sha256") && (data.length() == SHA256_BLOCK_SIZE) && ((ID & PROV_SHA) > 0))
{
- SHA256ResetRequest(this, Provider).Send();
- if (!strcasecmp(data.c_str(), SHA256SumRequest(this, Provider, input.c_str()).Send()))
+ SHA256ResetRequest(this, SHAProvider).Send();
+ if (!strcasecmp(data.c_str(), SHA256SumRequest(this, SHAProvider, input.c_str()).Send()))
return 1;
else return -1;
}
else if ((hashtype == "md5") && (data.length() == 32) && ((ID & PROV_MD5) > 0))
{
- MD5ResetRequest(this, Provider).Send();
- if (!strcasecmp(data.c_str(), MD5SumRequest(this, Provider, input.c_str()).Send()))
+ MD5ResetRequest(this, MD5Provider).Send();
+ if (!strcasecmp(data.c_str(), MD5SumRequest(this, MD5Provider, input.c_str()).Send()))
return 1;
else return -1;
}