From 9a0b1efc24e84c7cf17a0e87c98fd1e22fe1c356 Mon Sep 17 00:00:00 2001 From: DukePyrolator Date: Mon, 2 Nov 2009 05:22:35 +0000 Subject: added a way to load multiple encryption modules at the same and to switch between encryption methods git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2602 5417fbe8-f217-4b02-8779-1006273d7864 --- src/core/enc_sha1.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/core/enc_sha1.c') diff --git a/src/core/enc_sha1.c b/src/core/enc_sha1.c index 398b052fb..9c86875fe 100644 --- a/src/core/enc_sha1.c +++ b/src/core/enc_sha1.c @@ -259,16 +259,23 @@ class ESHA1 : public Module } - EventReturn OnCheckPassword(const char *plaintext, const char *password) + EventReturn OnCheckPassword(const char *plaintext, char *password) { char buf[BUFSIZE]; if (OnEncrypt(plaintext, strlen(plaintext), buf, sizeof(buf)) == EVENT_STOP) return EVENT_STOP; if (memcmp(buf, password, 20) == 0) { + /* when we are NOT the first module in the list, + * we want to re-encrypt the pass with the new encryption + */ + if (stricmp(EncModuleList[0], this->name.c_str())) + { + enc_encrypt(plaintext, strlen(password), password, PASSMAX -1 ); + } return EVENT_ALLOW; } - return EVENT_STOP; + return EVENT_CONTINUE; } }; -- cgit