summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-07-05 15:45:28 -0400
committerAdam <Adam@anope.org>2010-07-05 15:45:28 -0400
commite42f125a850c11ead01602e01da53ba9200621ab (patch)
tree5696b0b38380b5f88e03e4c0f2ca8ab24235f03b
parentf5a7a5d8bcc5645a6667f2c6328060dbaa407218 (diff)
Removed enc_encrypt_in_place, it is unnecessary and using it like it was designed breaks long passwords.
-rw-r--r--include/encrypt.h1
-rw-r--r--include/extern.h2
-rw-r--r--src/core/enc_md5.c8
-rw-r--r--src/core/enc_none.c7
-rw-r--r--src/core/enc_old.c9
-rw-r--r--src/core/enc_sha1.c16
-rw-r--r--src/encrypt.c18
-rw-r--r--version.log3
8 files changed, 2 insertions, 62 deletions
diff --git a/include/encrypt.h b/include/encrypt.h
index 33c2eb36c..0b4c81bb4 100644
--- a/include/encrypt.h
+++ b/include/encrypt.h
@@ -13,7 +13,6 @@
typedef struct encryption_ {
int (*encrypt)(const char *src, int len, char *dest, int size);
- int (*encrypt_in_place)(char *buf, int size);
int (*encrypt_check_len)(int passlen, int bufsize);
int (*decrypt)(const char *src, char *dest, int size);
int (*check_password)(const char *plaintext, const char *password);
diff --git a/include/extern.h b/include/extern.h
index d63d7d1fd..c9d67cdbb 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -576,12 +576,10 @@ E long unsigned int UserKey3;
/**** encrypt.c ****/
E char *EncModule;
E int enc_encrypt(const char *src, int len, char *dest, int size);
-E int enc_encrypt_in_place(char *buf, int size);
E int enc_encrypt_check_len(int passlen, int bufsize);
E int enc_decrypt(const char *src, char *dest, int size);
E int enc_check_password(const char *plaintext, const char *password);
E void encmodule_encrypt(int (*func)(const char *src, int len, char *dest, int size));
-E void encmodule_encrypt_in_place(int (*func)(char *buf, int size));
E void encmodule_encrypt_check_len(int (*func)(int passlen, int bufsize));
E void encmodule_decrypt(int (*func)(const char *src, char *dest, int size));
E void encmodule_check_password(int (*func)(const char *plaintext, const char *password));
diff --git a/src/core/enc_md5.c b/src/core/enc_md5.c
index b9f12ed57..59a96cae0 100644
--- a/src/core/enc_md5.c
+++ b/src/core/enc_md5.c
@@ -362,12 +362,6 @@ int md5_encrypt(const char *src, int len, char *dest, int size)
}
-int md5_encrypt_in_place(char *buf, int size)
-{
- return md5_encrypt(buf, strlen(buf), buf, size);
-}
-
-
int md5_encrypt_check_len(int passlen, int bufsize)
{
if (bufsize < 16)
@@ -404,7 +398,6 @@ int AnopeInit(int argc, char **argv) {
moduleSetType(ENCRYPTION);
encmodule_encrypt(md5_encrypt);
- encmodule_encrypt_in_place(md5_encrypt_in_place);
encmodule_encrypt_check_len(md5_encrypt_check_len);
encmodule_decrypt(md5_decrypt);
encmodule_check_password(md5_check_password);
@@ -414,7 +407,6 @@ int AnopeInit(int argc, char **argv) {
void AnopeFini(void) {
encmodule_encrypt(NULL);
- encmodule_encrypt_in_place(NULL);
encmodule_encrypt_check_len(NULL);
encmodule_decrypt(NULL);
encmodule_check_password(NULL);
diff --git a/src/core/enc_none.c b/src/core/enc_none.c
index aa5fd0a96..0a6bb694e 100644
--- a/src/core/enc_none.c
+++ b/src/core/enc_none.c
@@ -10,7 +10,6 @@
#include "module.h"
int plain_encrypt(const char *src,int len,char *dest,int size);
-int plain_encrypt_in_place(char *buf, int size);
int plain_encrypt_check_len(int passlen, int bufsize);
int plain_decrypt(const char *src, char *dest, int size);
int plain_check_password(const char *plaintext, const char *password);
@@ -23,7 +22,6 @@ int AnopeInit(int argc, char **argv) {
moduleSetType(ENCRYPTION);
encmodule_encrypt(plain_encrypt);
- encmodule_encrypt_in_place(plain_encrypt_in_place);
encmodule_encrypt_check_len(plain_encrypt_check_len);
encmodule_decrypt(plain_decrypt);
encmodule_check_password(plain_check_password);
@@ -33,7 +31,6 @@ int AnopeInit(int argc, char **argv) {
void AnopeFini(void) {
encmodule_encrypt(NULL);
- encmodule_encrypt_in_place(NULL);
encmodule_encrypt_check_len(NULL);
encmodule_decrypt(NULL);
encmodule_check_password(NULL);
@@ -49,10 +46,6 @@ int plain_encrypt(const char *src,int len,char *dest,int size) {
return -1;
}
-int plain_encrypt_in_place(char *buf, int size) {
- return 0;
-}
-
int plain_encrypt_check_len(int passlen, int bufsize) {
if(bufsize>=passlen) {
return 0;
diff --git a/src/core/enc_old.c b/src/core/enc_old.c
index be593e367..8040c2906 100644
--- a/src/core/enc_old.c
+++ b/src/core/enc_old.c
@@ -388,13 +388,6 @@ int old_encrypt(const char *src, int len, char *dest, int size)
}
-
-/* Shortcut for encrypting a null-terminated string in place. */
-int old_encrypt_in_place(char *buf, int size)
-{
- return old_encrypt(buf, strlen(buf), buf, size);
-}
-
int old_encrypt_check_len(int passlen, int bufsize)
{
if (bufsize < 16)
@@ -430,7 +423,6 @@ int AnopeInit(int argc, char **argv) {
moduleSetType(ENCRYPTION);
encmodule_encrypt(old_encrypt);
- encmodule_encrypt_in_place(old_encrypt_in_place);
encmodule_encrypt_check_len(old_encrypt_check_len);
encmodule_decrypt(old_decrypt);
encmodule_check_password(old_check_password);
@@ -440,7 +432,6 @@ int AnopeInit(int argc, char **argv) {
void AnopeFini(void) {
encmodule_encrypt(NULL);
- encmodule_encrypt_in_place(NULL);
encmodule_encrypt_check_len(NULL);
encmodule_decrypt(NULL);
encmodule_check_password(NULL);
diff --git a/src/core/enc_sha1.c b/src/core/enc_sha1.c
index 4ab4afcdb..3fa08fc73 100644
--- a/src/core/enc_sha1.c
+++ b/src/core/enc_sha1.c
@@ -204,20 +204,6 @@ int sha1_encrypt(const char *src, int len, char *dest, int size)
}
-int sha1_encrypt_in_place(char *buf, int size)
-{
- char tmp[41];
-
- memset(tmp,0,41);
- if(sha1_encrypt(buf, strlen(buf), tmp, size)==0) {
- memcpy(buf, tmp, size);
- } else {
- return -1;
- }
- return 0;
-}
-
-
int sha1_encrypt_check_len(int passlen, int bufsize)
{
if (bufsize < 20)
@@ -255,7 +241,6 @@ int AnopeInit(int argc, char **argv) {
moduleSetType(ENCRYPTION);
encmodule_encrypt(sha1_encrypt);
- encmodule_encrypt_in_place(sha1_encrypt_in_place);
encmodule_encrypt_check_len(sha1_encrypt_check_len);
encmodule_decrypt(sha1_decrypt);
encmodule_check_password(sha1_check_password);
@@ -265,7 +250,6 @@ int AnopeInit(int argc, char **argv) {
void AnopeFini(void) {
encmodule_encrypt(NULL);
- encmodule_encrypt_in_place(NULL);
encmodule_encrypt_check_len(NULL);
encmodule_decrypt(NULL);
encmodule_check_password(NULL);
diff --git a/src/encrypt.c b/src/encrypt.c
index 2c85d444a..0555c221a 100644
--- a/src/encrypt.c
+++ b/src/encrypt.c
@@ -23,11 +23,6 @@ void encmodule_encrypt(int (*func)
encryption.encrypt = func;
}
-void encmodule_encrypt_in_place(int (*func) (char *buf, int size))
-{
- encryption.encrypt_in_place = func;
-}
-
void encmodule_encrypt_check_len(int (*func) (int passlen, int bufsize))
{
encryption.encrypt_check_len = func;
@@ -60,19 +55,6 @@ int enc_encrypt(const char *src, int len, char *dest, int size)
return -1;
}
-/**
- * Encrypt null-terminated string stored in buffer `buf' of size `size',
- * placing the result in the same buffer. Returns 0 on success, -1 on
- * error.
- **/
-int enc_encrypt_in_place(char *buf, int size)
-{
- if (encryption.encrypt_in_place) {
- return encryption.encrypt_in_place(buf, size);
- }
- return -1;
-}
-
/**
* Check whether the result of encrypting a password of length `passlen'
* will fit in a buffer of size `bufsize'. Returns 0 if the encrypted
diff --git a/version.log b/version.log
index 049e0754e..67fda81d0 100644
--- a/version.log
+++ b/version.log
@@ -8,9 +8,10 @@ VERSION_MAJOR="1"
VERSION_MINOR="8"
VERSION_PATCH="4"
VERSION_EXTRA="-git"
-VERSION_BUILD="3011"
+VERSION_BUILD="3012"
# $Log$ # Changes since the 1.8.4 Release
+#Revision 3012 - Removed enc_encrypt_in_place, it is unnecessary and it can easially be used improperly
#Revision 3010 - Encrypt very long passwords properly on /ns and /cs register
#Revision 3009 - Fixed charybdis and ratbox protocol modules not (properly) translating TS6 UIDs into nicks on kills.
#Revision 3007 - Removed all references to the SVN keyword $Id$