1
0
mirror of https://github.com/anope/anope.git synced 2026-07-10 15:43:13 +02:00

Moved some files and diretories around, made cmake skip files it knows it can't compile because of missing dependices.

This commit is contained in:
Adam
2010-07-15 22:55:02 -04:00
parent 43b1e43afb
commit a22f8d3b2d
190 changed files with 324 additions and 479 deletions
+67
View File
@@ -0,0 +1,67 @@
/* Module for plain text encryption.
*
* (C) 2003-2010 Anope Team
* Contact us at team@anope.org
*
* This program is free but copyrighted software; see the file COPYING for
* details.
*/
#include "module.h"
class ENone : public Module
{
public:
ENone(const std::string &modname, const std::string &creator) : Module(modname, creator)
{
this->SetAuthor("Anope");
this->SetType(ENCRYPTION);
ModuleManager::Attach(I_OnEncrypt, this);
ModuleManager::Attach(I_OnDecrypt, this);
ModuleManager::Attach(I_OnCheckPassword, this);
}
EventReturn OnEncrypt(const std::string &src, std::string &dest)
{
std::string buf = "plain:";
char cpass[1000];
b64_encode(src.c_str(), src.size(), cpass, 1000);
buf += cpass;
Alog(LOG_DEBUG_2) << "(enc_none) hashed password from [" << src << "] to [" << buf << "]";
dest = buf;
return EVENT_ALLOW;
}
EventReturn OnDecrypt(const std::string &hashm, const std::string &src, std::string &dest)
{
if (hashm != "plain")
return EVENT_CONTINUE;
char cpass[1000] = "";
size_t pos = src.find(":");
std::string buf(src.begin() + pos + 1, src.end());
b64_decode(buf.c_str(), cpass, 1000);
dest = cpass;
return EVENT_ALLOW;
}
EventReturn OnCheckPassword(const std::string &hashm, std::string &plaintext, std::string &password)
{
if (hashm != "plain")
return EVENT_CONTINUE;
std::string buf;
this->OnEncrypt(plaintext, buf);
if (password == buf)
{
/* if we are NOT the first module in the list,
* we want to re-encrypt the pass with the new encryption
*/
if (Config.EncModuleList.front() != this->name)
enc_encrypt(plaintext, password);
return EVENT_ALLOW;
}
return EVENT_STOP;
}
};
MODULE_INIT(ENone)