summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2016-05-23 19:09:47 +0100
committerPeter Powell <petpow@saberuk.com>2016-09-13 22:33:41 +0100
commit3b0f52c92b744836520af4b9915478569f297d39 (patch)
tree1816865eccc62fb60a9e546a298dfc74e51504f4
parent164ad71fc36f79efc823b7523de79603f6e0ac27 (diff)
Remove Anope::Decrypt now encryption is mandated.
-rw-r--r--include/anope.h8
-rw-r--r--include/event.h9
-rw-r--r--modules/encryption/none.cpp12
-rw-r--r--modules/nickserv/register.cpp4
-rw-r--r--modules/nickserv/set.cpp10
-rw-r--r--src/misc.cpp17
6 files changed, 2 insertions, 58 deletions
diff --git a/include/anope.h b/include/anope.h
index c298d5d86..f3f05cb15 100644
--- a/include/anope.h
+++ b/include/anope.h
@@ -474,14 +474,6 @@ namespace Anope
*/
extern CoreExport void Encrypt(const Anope::string &src, Anope::string &dest);
- /** Decrypts what is in 'src' to 'dest'.
- * @param src The source string to decrypt
- * @param dest The destination where the decrypted string is placed
- * @return true if decryption was successful. This is usually not the case
- * as most encryption methods we use are one way.
- */
- extern CoreExport bool Decrypt(const Anope::string &src, Anope::string &dest);
-
/** Returns a sequence of data formatted as the format argument specifies.
** After the format parameter, the function expects at least as many
** additional arguments as specified in format.
diff --git a/include/event.h b/include/event.h
index 7705e44e3..b71eef738 100644
--- a/include/event.h
+++ b/include/event.h
@@ -327,15 +327,6 @@ namespace Event
virtual EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_abstract;
};
- struct CoreExport Decrypt : Events
- {
- static constexpr const char *NAME = "decrypt";
-
- using Events::Events;
-
- virtual EventReturn OnDecrypt(const Anope::string &hashm, const Anope::string &src, Anope::string &dest) anope_abstract;
- };
-
struct CoreExport CreateBot : Events
{
static constexpr const char *NAME = "createbot";
diff --git a/modules/encryption/none.cpp b/modules/encryption/none.cpp
index 840ab7b42..3b1f49d33 100644
--- a/modules/encryption/none.cpp
+++ b/modules/encryption/none.cpp
@@ -21,13 +21,11 @@
class ENone : public Module
, public EventHook<Event::Encrypt>
- , public EventHook<Event::Decrypt>
, public EventHook<Event::CheckAuthentication>
{
public:
ENone(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION | VENDOR)
, EventHook<Event::Encrypt>(this)
- , EventHook<Event::Decrypt>(this)
, EventHook<Event::CheckAuthentication>(this)
{
if (ModuleManager::FindFirstOf(ENCRYPTION) == this)
@@ -45,16 +43,6 @@ class ENone : public Module
return EVENT_ALLOW;
}
- EventReturn OnDecrypt(const Anope::string &hashm, const Anope::string &src, Anope::string &dest) override
- {
- if (!hashm.equals_cs("plain"))
- return EVENT_CONTINUE;
- size_t pos = src.find(':');
- Anope::string buf = src.substr(pos + 1);
- Anope::B64Decode(buf, dest);
- return EVENT_ALLOW;
- }
-
void OnCheckAuthentication(User *, NickServ::IdentifyRequest *req) override
{
NickServ::Nick *na = NickServ::FindNick(req->GetAccount());
diff --git a/modules/nickserv/register.cpp b/modules/nickserv/register.cpp
index 41c0e716b..f7e93c9a1 100644
--- a/modules/nickserv/register.cpp
+++ b/modules/nickserv/register.cpp
@@ -244,10 +244,6 @@ class CommandNSRegister : public Command
source.Reply(_("\002{0}\002 has been registered."), u_nick);
- Anope::string tmp_pass;
- if (Anope::Decrypt(na->GetAccount()->GetPassword(), tmp_pass))
- source.Reply(_("Your password is \002{0}\002 - remember this for later use."), tmp_pass);
-
if (nsregister.equals_ci("admin"))
{
nc->SetS<bool>("UNCONFIRMED", true);
diff --git a/modules/nickserv/set.cpp b/modules/nickserv/set.cpp
index c733f93d2..12086e801 100644
--- a/modules/nickserv/set.cpp
+++ b/modules/nickserv/set.cpp
@@ -160,10 +160,7 @@ class CommandNSSetPassword : public Command
Anope::Encrypt(param, tmp_pass);
source.nc->SetPassword(tmp_pass);
- if (Anope::Decrypt(source.nc->GetPassword(), tmp_pass))
- source.Reply(_("Password for \002{0}\002 changed to \002{1]\002."), source.nc->GetDisplay(), tmp_pass);
- else
- source.Reply(_("Password for \002{0}\002 changed."), source.nc->GetDisplay());
+ source.Reply(_("Password for \002{0}\002 changed."), source.nc->GetDisplay());
}
bool OnHelp(CommandSource &source, const Anope::string &) override
@@ -223,10 +220,7 @@ class CommandNSSASetPassword : public Command
Anope::string tmp_pass;
Anope::Encrypt(params[1], tmp_pass);
nc->SetPassword(tmp_pass);
- if (Anope::Decrypt(nc->GetPassword(), tmp_pass) == 1)
- source.Reply(_("Password for \002{0}\002 changed to \002{1}\002."), nc->GetDisplay(), tmp_pass);
- else
- source.Reply(_("Password for \002{0}\002 changed."), nc->GetDisplay());
+ source.Reply(_("Password for \002{0}\002 changed."), nc->GetDisplay());
}
bool OnHelp(CommandSource &source, const Anope::string &) override
diff --git a/src/misc.cpp b/src/misc.cpp
index f5e610133..dc8d68f43 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -492,23 +492,6 @@ void Anope::Encrypt(const Anope::string &src, Anope::string &dest)
static_cast<void>(MOD_RESULT);
}
-bool Anope::Decrypt(const Anope::string &src, Anope::string &dest)
-{
- size_t pos = src.find(':');
- if (pos == Anope::string::npos)
- {
- Log() << "Error: Anope::Decrypt() called with invalid password string (" << src << ")";
- return false;
- }
- Anope::string hashm(src.begin(), src.begin() + pos);
-
- EventReturn MOD_RESULT = EventManager::Get()->Dispatch(&Event::Decrypt::OnDecrypt, hashm, src, dest);
- if (MOD_RESULT == EVENT_ALLOW)
- return true;
-
- return false;
-}
-
Anope::string Anope::printf(const char *fmt, ...)
{
va_list args;