1
0
mirror of https://github.com/anope/anope.git synced 2026-06-27 18:46:39 +02:00

Allow modules to use the encryption modules to encrypt arbitrary things.

Made enc_old depend on enc_md5.
Allow not loading any encryption modules if you want to only use an
external mechanism.
Removed ns_sendpass since it's just a bad idea.
This commit is contained in:
Adam
2012-11-30 02:49:09 -05:00
parent 337f361526
commit a4468dd56e
15 changed files with 688 additions and 966 deletions
+24
View File
@@ -450,6 +450,30 @@ bool Anope::Match(const Anope::string &str, const Anope::string &mask, bool case
return m == mask_len;
}
void Anope::Encrypt(const Anope::string &src, Anope::string &dest)
{
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnEncrypt, OnEncrypt(src, dest));
}
bool Anope::Decrypt(const Anope::string &src, Anope::string &dest)
{
size_t pos = src.find(':');
if (pos == Anope::string::npos)
{
Log() << "Error: Anope::Decrypt() called with invalid password string (" << src << ")";
return false;
}
Anope::string hashm(src.begin(), src.begin() + pos);
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnDecrypt, OnDecrypt(hashm, src, dest));
if (MOD_RESULT == EVENT_ALLOW)
return true;
return false;
}
Anope::string Anope::printf(const char *fmt, ...)
{
va_list args;