1
0
mirror of https://github.com/anope/anope.git synced 2026-07-01 06:36:39 +02:00

Convert encryption modules.

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1553 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
Robin Burchell w00t@inspircd.org
2008-11-04 22:19:15 +00:00
parent d54364d426
commit 7affa0982a
4 changed files with 96 additions and 88 deletions
+24 -22
View File
@@ -383,33 +383,35 @@ int md5_check_password(const char *plaintext, const char *password)
/* Module stuff. */
int AnopeInit(int argc, char **argv) {
class EMD5 : public Module
{
public:
EMD5(const std::string &creator) : Module(creator)
{
moduleAddAuthor("Anope");
moduleAddVersion("$Id$");
moduleSetType(ENCRYPTION);
moduleAddAuthor("Anope");
moduleAddVersion("$Id$");
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);
return MOD_CONT;
}
void AnopeFini(void) {
encmodule_encrypt(NULL);
encmodule_encrypt_in_place(NULL);
encmodule_encrypt_check_len(NULL);
encmodule_decrypt(NULL);
encmodule_check_password(NULL);
}
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);
}
~EMD5()
{
encmodule_encrypt(NULL);
encmodule_encrypt_in_place(NULL);
encmodule_encrypt_check_len(NULL);
encmodule_decrypt(NULL);
encmodule_check_password(NULL);
}
};
/*************************************************************************/
MODULE_INIT("enc_md5")
MODULE_INIT(EMD5)
+24 -22
View File
@@ -15,29 +15,31 @@ 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);
class ENone : public Module
{
public:
ENone(const std::string &creator) : Module(creator)
{
moduleAddAuthor("Anope");
moduleAddVersion("$Id$");
moduleSetType(ENCRYPTION);
int AnopeInit(int argc, char **argv) {
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);
}
moduleAddAuthor("Anope");
moduleAddVersion("$Id$");
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);
return MOD_CONT;
}
void AnopeFini(void) {
encmodule_encrypt(NULL);
encmodule_encrypt_in_place(NULL);
encmodule_encrypt_check_len(NULL);
encmodule_decrypt(NULL);
encmodule_check_password(NULL);
}
~ENone()
{
encmodule_encrypt(NULL);
encmodule_encrypt_in_place(NULL);
encmodule_encrypt_check_len(NULL);
encmodule_decrypt(NULL);
encmodule_check_password(NULL);
}
};
int plain_encrypt(const char *src,int len,char *dest,int size) {
if(size>=len) {
@@ -77,4 +79,4 @@ int plain_check_password(const char *plaintext, const char *password) {
/* EOF */
MODULE_INIT("enc_none")
MODULE_INIT(ENone)
+24 -21
View File
@@ -410,30 +410,33 @@ int old_decrypt(const char *src, char *dest, int size)
return 0;
}
int AnopeInit(int argc, char **argv) {
class EOld : public Module
{
public:
EOld(const std::string &creator) : Module(creator)
{
moduleAddAuthor("Anope");
moduleAddVersion("$Id$");
moduleSetType(ENCRYPTION);
moduleAddAuthor("Anope");
moduleAddVersion("$Id$");
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);
}
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);
return MOD_CONT;
}
void AnopeFini(void) {
encmodule_encrypt(NULL);
encmodule_encrypt_in_place(NULL);
encmodule_encrypt_check_len(NULL);
encmodule_decrypt(NULL);
encmodule_check_password(NULL);
}
~EOld()
{
encmodule_encrypt(NULL);
encmodule_encrypt_in_place(NULL);
encmodule_encrypt_check_len(NULL);
encmodule_decrypt(NULL);
encmodule_check_password(NULL);
}
};
/*************************************************************************/
MODULE_INIT("enc_old")
MODULE_INIT(EOld)
+24 -23
View File
@@ -248,30 +248,31 @@ int sha1_check_password(const char *plaintext, const char *password)
/* Module stuff. */
int AnopeInit(int argc, char **argv) {
class ESHA1 : public Module
{
public:
ESHA1(const std::string &creator) : Module(creator)
{
moduleAddAuthor("Anope");
moduleAddVersion("$Id$");
moduleSetType(ENCRYPTION);
moduleAddAuthor("Anope");
moduleAddVersion("$Id$");
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);
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);
}
return MOD_CONT;
}
void AnopeFini(void) {
encmodule_encrypt(NULL);
encmodule_encrypt_in_place(NULL);
encmodule_encrypt_check_len(NULL);
encmodule_decrypt(NULL);
encmodule_check_password(NULL);
}
/* EOF */
~ESHA1()
{
encmodule_encrypt(NULL);
encmodule_encrypt_in_place(NULL);
encmodule_encrypt_check_len(NULL);
encmodule_decrypt(NULL);
encmodule_check_password(NULL);
}
};
MODULE_INIT("enc_sha1")
MODULE_INIT(ESHA1)