diff options
author | DukePyrolator <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-07-01 17:36:48 +0000 |
---|---|---|
committer | DukePyrolator <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-07-01 17:36:48 +0000 |
commit | d81068abc4e16e0ea64db84625bf34c51af96282 (patch) | |
tree | 8d629ee7482af44239df3f06fd0c83fcd71182ea /src/encrypt.c | |
parent | 5a9dd79ae816e2857dea8eaa5e2801742e1be1fa (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/encrypt.c')
-rw-r--r-- | src/encrypt.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/src/encrypt.c b/src/encrypt.c index 071aa2d8b..4b5db587e 100644 --- a/src/encrypt.c +++ b/src/encrypt.c @@ -26,10 +26,8 @@ int enc_encrypt(const char *src, int len, char *dest, int size) EventReturn MOD_RESULT; FOREACH_RESULT(I_OnEncrypt, OnEncrypt(src, len, dest, size)); if (MOD_RESULT == EVENT_ALLOW) - return 1; - if (MOD_RESULT == EVENT_STOP) - return -1; - return 0; + return 0; + return -1; } /** @@ -42,10 +40,8 @@ int enc_encrypt_in_place(char *buf, int size) EventReturn MOD_RESULT; FOREACH_RESULT(I_OnEncryptInPlace, OnEncryptInPlace(buf, size)); if (MOD_RESULT == EVENT_ALLOW) - return 1; - if (MOD_RESULT == EVENT_STOP) - return -1; - return 0; + return 0; + return -1; } @@ -62,15 +58,13 @@ int enc_encrypt_check_len(int passlen, int bufsize) EventReturn MOD_RESULT; FOREACH_RESULT(I_OnEncryptCheckLen, OnEncryptCheckLen(passlen, bufsize)); if (MOD_RESULT == EVENT_ALLOW) - return 1; - if (MOD_RESULT == EVENT_STOP) - return -1; - return 0; + return 0; + return -1; } /** * Decrypt encrypted string `src' into buffer `dest' of length `len'. - * Returns 1 (not 0) on success, 0 if the encryption algorithm does not + * Returns 1 (not 0) on success, -1 if the encryption algorithm does not * allow decryption, and -1 if another failure occurred (e.g. destination * buffer too small). **/ @@ -80,9 +74,7 @@ int enc_decrypt(const char *src, char *dest, int size) FOREACH_RESULT(I_OnDecrypt, OnDecrypt(src, dest, size)); if (MOD_RESULT == EVENT_ALLOW) return 1; - if (MOD_RESULT == EVENT_STOP) - return -1; - return 0; + return -1; } /** @@ -90,7 +82,7 @@ int enc_decrypt(const char *src, char *dest, int size) * `password'. Return value is: * 1 if the password matches * 0 if the password does not match - * -1 if an error occurred while checking + * 0 if an error occurred while checking **/ int enc_check_password(const char *plaintext, const char *password) { @@ -98,8 +90,6 @@ int enc_check_password(const char *plaintext, const char *password) FOREACH_RESULT(I_OnCheckPassword, OnCheckPassword(plaintext, password)); if (MOD_RESULT == EVENT_ALLOW) return 1; - if (MOD_RESULT == EVENT_STOP) - return -1; return 0; } |