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_old.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/core/enc_old.c') diff --git a/src/core/enc_old.c b/src/core/enc_old.c index 3da4e5155..c3db6c4b3 100644 --- a/src/core/enc_old.c +++ b/src/core/enc_old.c @@ -398,7 +398,7 @@ class EOld : public Module /* Compare a plaintext string against an encrypted password. Return 1 if * they match, 0 if not, and -1 if something went wrong. */ - EventReturn OnCheckPassword(const char *plaintext, const char *password) + EventReturn OnCheckPassword(const char *plaintext, char *password) { char buf[BUFSIZE]; @@ -406,9 +406,16 @@ class EOld : public Module return EVENT_STOP; if (memcmp(buf, password, 16) == 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; } EventReturn OnDecrypt(const char *src, char *dest, int size) -- cgit