summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/enc_md5.c11
-rw-r--r--src/core/enc_none.c12
-rw-r--r--src/core/enc_old.c11
-rw-r--r--src/core/enc_sha1.c11
4 files changed, 37 insertions, 8 deletions
diff --git a/src/core/enc_md5.c b/src/core/enc_md5.c
index 00d9a40ae..103f4bbe7 100644
--- a/src/core/enc_md5.c
+++ b/src/core/enc_md5.c
@@ -397,7 +397,7 @@ class EMD5 : public Module
}
- EventReturn OnCheckPassword(const char *plaintext, const char *password)
+ EventReturn OnCheckPassword(const char *plaintext, char *password)
{
char buf[BUFSIZE];
@@ -405,9 +405,16 @@ class EMD5 : public Module
return EVENT_STOP;
if (memcmp(buf, password, 16) == 0)
{
+ /* if 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;
}
};
diff --git a/src/core/enc_none.c b/src/core/enc_none.c
index 91784bca4..99b3e17a4 100644
--- a/src/core/enc_none.c
+++ b/src/core/enc_none.c
@@ -56,12 +56,20 @@ class ENone : public Module
return EVENT_ALLOW;
}
- EventReturn OnCheckPassword(const char *plaintext, const char *password) {
+ EventReturn OnCheckPassword(const char *plaintext, char *password)
+ {
if(strcmp(plaintext,password)==0)
{
+ /* if 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;
}
};
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)
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;
}
};