summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorDukePyrolator <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864>2009-07-01 17:36:48 +0000
committerDukePyrolator <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864>2009-07-01 17:36:48 +0000
commitd81068abc4e16e0ea64db84625bf34c51af96282 (patch)
tree8d629ee7482af44239df3f06fd0c83fcd71182ea /src/core
parent5a9dd79ae816e2857dea8eaa5e2801742e1be1fa (diff)
fix for bug #1087. thanks to Obi_Wan for reporting and testing.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2350 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core')
-rw-r--r--src/core/enc_md5.c11
-rw-r--r--src/core/enc_none.c15
-rw-r--r--src/core/enc_old.c13
-rw-r--r--src/core/enc_sha1.c22
4 files changed, 35 insertions, 26 deletions
diff --git a/src/core/enc_md5.c b/src/core/enc_md5.c
index c7c7ccff7..95b7b20c6 100644
--- a/src/core/enc_md5.c
+++ b/src/core/enc_md5.c
@@ -370,7 +370,7 @@ class EMD5 : public Module
}
}
- return EVENT_STOP;
+ return EVENT_ALLOW;
}
@@ -383,8 +383,11 @@ class EMD5 : public Module
EventReturn OnEncryptCheckLen(int passlen, int bufsize)
{
if (bufsize < 16)
+ {
fatal("enc_md5: md5_check_len(): buffer too small (%d)", bufsize);
- return EVENT_STOP;
+ return EVENT_STOP;
+ }
+ return EVENT_ALLOW;
}
@@ -402,9 +405,9 @@ class EMD5 : public Module
return EVENT_STOP;
if (memcmp(buf, password, 16) == 0)
{
- return EVENT_ALLOW;
+ return EVENT_ALLOW;
}
- return EVENT_CONTINUE;
+ return EVENT_STOP;
}
};
diff --git a/src/core/enc_none.c b/src/core/enc_none.c
index 25f2fe216..fc70c68c2 100644
--- a/src/core/enc_none.c
+++ b/src/core/enc_none.c
@@ -32,22 +32,23 @@ class ENone : public Module
memset(dest,0,size);
strncpy(dest,src,len);
dest[len] = '\0';
- return EVENT_STOP;
+ return EVENT_ALLOW;
}
- return EVENT_STOP;
+ return EVENT_STOP;
}
EventReturn OnEncryptInPlace(char *buf, int size)
{
- return EVENT_STOP;
+ return EVENT_ALLOW;
}
EventReturn OnEncryptCheckLen(int passlen, int bufsize)
{
- if(bufsize>=passlen) {
- return EVENT_STOP;
+ if(bufsize>=passlen)
+ {
+ return EVENT_ALLOW;
}
- return EVENT_ALLOW; // return 1
+ return EVENT_STOP;
}
EventReturn OnDecrypt(const char *src, char *dest, int size) {
@@ -62,7 +63,7 @@ class ENone : public Module
{
return EVENT_ALLOW;
}
- return EVENT_CONTINUE;
+ return EVENT_STOP;
}
};
diff --git a/src/core/enc_old.c b/src/core/enc_old.c
index 399caa584..c70ed23b1 100644
--- a/src/core/enc_old.c
+++ b/src/core/enc_old.c
@@ -367,14 +367,14 @@ class EOld : public Module
for (i = 0; i < 32; i += 2)
dest[i / 2] = XTOI(digest[i]) << 4 | XTOI(digest[i + 1]);
- if(debug)
+ if(debug)
{
memset(tmp,0,33);
binary_to_hex((unsigned char *)dest,tmp,16);
alog("enc_old: Converted [%s] to [%s]",src,tmp);
}
- return EVENT_STOP;
+ return EVENT_ALLOW;
}
@@ -387,8 +387,11 @@ class EOld : public Module
EventReturn OnEncryptCheckLen(int passlen, int bufsize)
{
if (bufsize < 16)
+ {
fatal("enc_old: old_check_len(): buffer too small (%d)", bufsize);
- return EVENT_STOP;
+ return EVENT_STOP;
+ }
+ return EVENT_ALLOW;
}
@@ -405,12 +408,12 @@ class EOld : public Module
{
return EVENT_ALLOW;
}
- return EVENT_CONTINUE;
+ return EVENT_STOP;
}
EventReturn OnDecrypt(const char *src, char *dest, int size)
{
- return EVENT_CONTINUE; // 0
+ return EVENT_STOP; // 0
}
};
diff --git a/src/core/enc_sha1.c b/src/core/enc_sha1.c
index 143f14aa0..d67fd630e 100644
--- a/src/core/enc_sha1.c
+++ b/src/core/enc_sha1.c
@@ -204,7 +204,7 @@ class ESHA1 : public Module
unsigned char tmp[41];
if (size < 20)
- return EVENT_ALLOW;
+ return EVENT_STOP;
memset(dest,0,size);
@@ -224,7 +224,7 @@ class ESHA1 : public Module
alog("enc_sha1: hashed password to [%s]",tmp);
}
}
- return EVENT_STOP;
+ return EVENT_ALLOW;
}
@@ -233,11 +233,10 @@ class ESHA1 : public Module
char tmp[41];
memset(tmp,0,41);
- if(OnEncrypt(buf, strlen(buf), tmp, size)==EVENT_STOP)
+ if(OnEncrypt(buf, strlen(buf), tmp, size)==EVENT_ALLOW)
{
memcpy(buf, tmp, size);
- } else {
- return EVENT_STOP;
+ return EVENT_ALLOW;
}
return EVENT_STOP;
}
@@ -246,8 +245,11 @@ class ESHA1 : public Module
EventReturn OnEncryptCheckLen(int passlen, int bufsize)
{
if (bufsize < 20)
+ {
fatal("enc_sha1: sha1_check_len(): buffer too small (%d)", bufsize);
- return EVENT_STOP;
+ return EVENT_STOP;
+ }
+ return EVENT_ALLOW;
}
@@ -260,13 +262,13 @@ class ESHA1 : public Module
EventReturn OnCheckPassword(const char *plaintext, const char *password)
{
char buf[BUFSIZE];
- if (OnEncrypt(plaintext, strlen(plaintext), buf, sizeof(buf)) == EVENT_ALLOW)
- return EVENT_STOP;
- if (memcmp(buf, password, 20) == 0)
+ if (OnEncrypt(plaintext, strlen(plaintext), buf, sizeof(buf)) == EVENT_STOP)
+ return EVENT_STOP;
+ if (memcmp(buf, password, 20) == 0)
{
return EVENT_ALLOW;
}
- return EVENT_CONTINUE;
+ return EVENT_STOP;
}
};