From 4ddc1cebd1b29b76ea78ee6c080ceebe9d83a513 Mon Sep 17 00:00:00 2001 From: cyberbotx Date: Mon, 9 Mar 2009 02:35:59 +0000 Subject: [PATCH] Fix bug #1028, the *_getpass and *_sendpass modules will now refuse to load if the given encryption module is unable to do decryption. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2147 5417fbe8-f217-4b02-8779-1006273d7864 --- src/core/cs_getpass.c | 6 +++++- src/core/cs_sendpass.c | 4 ++++ src/core/ns_getpass.c | 4 ++++ src/core/ns_sendpass.c | 4 ++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/core/cs_getpass.c b/src/core/cs_getpass.c index c26d4a349..019b8f09f 100644 --- a/src/core/cs_getpass.c +++ b/src/core/cs_getpass.c @@ -55,7 +55,7 @@ class CommandCSGetPass : public Command notice_lang(s_ChanServ, u, CHAN_X_FORBIDDEN, chan); return MOD_CONT; } - if(!enc_decrypt(ci->founderpass, tmp_pass, PASSMAX - 1)==1) + if (!enc_decrypt(ci->founderpass, tmp_pass, PASSMAX - 1)) { notice_lang(s_ChanServ, u, CHAN_GETPASS_UNAVAILABLE); return MOD_CONT; @@ -98,6 +98,10 @@ class CSGetPass : public Module this->AddCommand(CHANSERV, new CommandCSGetPass(), MOD_UNIQUE); this->SetChanHelp(myChanServHelp); + + char tmp_pass[PASSMAX]; + if (!enc_decrypt("tmp", tmp_pass, PASSMAX - 1)) + throw ModuleException("Incompatible with the encryption module being used"); } }; diff --git a/src/core/cs_sendpass.c b/src/core/cs_sendpass.c index e61f6e2ee..8643cdeb5 100644 --- a/src/core/cs_sendpass.c +++ b/src/core/cs_sendpass.c @@ -103,6 +103,10 @@ class CSSendPass : public Module if (!UseMail) throw ModuleException("sendpass may not be loaded if UseMail is loaded"); + + char tmp_pass[PASSMAX]; + if (!enc_decrypt("tmp", tmp_pass, PASSMAX - 1)) + throw ModuleException("Incompatible with the encryption module being used"); } }; diff --git a/src/core/ns_getpass.c b/src/core/ns_getpass.c index 05373cedb..34bbd3137 100644 --- a/src/core/ns_getpass.c +++ b/src/core/ns_getpass.c @@ -91,6 +91,10 @@ class NSGetPass : public Module this->AddCommand(NICKSERV, new CommandNSGetPass(), MOD_UNIQUE); this->SetNickHelp(myNickServHelp); + + char tmp_pass[PASSMAX]; + if (!enc_decrypt("tmp", tmp_pass, PASSMAX - 1)) + throw ModuleException("Incompatible with the encryption module being used"); } }; diff --git a/src/core/ns_sendpass.c b/src/core/ns_sendpass.c index 7f5e3ee25..503141b61 100644 --- a/src/core/ns_sendpass.c +++ b/src/core/ns_sendpass.c @@ -100,6 +100,10 @@ class NSSendPass : public Module if (!UseMail) throw ModuleException("Not using mail, whut."); + + char tmp_pass[PASSMAX]; + if (!enc_decrypt("tmp", tmp_pass, PASSMAX - 1)) + throw ModuleException("Incompatible with the encryption module being used"); } };