summaryrefslogtreecommitdiff
path: root/modules/encryption
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-10-07 22:39:58 -0400
committerAdam <Adam@anope.org>2012-10-07 22:39:58 -0400
commitb8b63ff115f0daddf479b0da507a2f731255a06d (patch)
treed6b82bf0dfc39fdfe6a6a23ba318bb0c2906d6c1 /modules/encryption
parent0a111c19764ed14ab5f724c78d9dd8c08a3c124f (diff)
Remove the asynchronous identifing hack and replace it with something better. Fixes m_*_authentication only being able to properly work when people identify normally using nickserv/identify
Diffstat (limited to 'modules/encryption')
-rw-r--r--modules/encryption/enc_md5.cpp18
-rw-r--r--modules/encryption/enc_none.cpp18
-rw-r--r--modules/encryption/enc_old.cpp18
-rw-r--r--modules/encryption/enc_sha1.cpp18
-rw-r--r--modules/encryption/enc_sha256.cpp18
5 files changed, 40 insertions, 50 deletions
diff --git a/modules/encryption/enc_md5.cpp b/modules/encryption/enc_md5.cpp
index 73bc29557..bcbe4aeed 100644
--- a/modules/encryption/enc_md5.cpp
+++ b/modules/encryption/enc_md5.cpp
@@ -339,33 +339,31 @@ class EMD5 : public Module
return EVENT_ALLOW;
}
- EventReturn OnCheckAuthentication(Command *c, CommandSource *source, const std::vector<Anope::string> &params, const Anope::string &account, const Anope::string &password) anope_override
+ void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override
{
- const NickAlias *na = findnick(account);
+ const NickAlias *na = findnick(req->GetAccount());
if (na == NULL)
- return EVENT_CONTINUE;
+ return;
NickCore *nc = na->nc;
size_t pos = nc->pass.find(':');
if (pos == Anope::string::npos)
- return EVENT_CONTINUE;
+ return;
Anope::string hash_method(nc->pass.begin(), nc->pass.begin() + pos);
if (!hash_method.equals_cs("md5"))
- return EVENT_CONTINUE;
+ return;
Anope::string buf;
- this->OnEncrypt(password, buf);
+ this->OnEncrypt(req->GetPassword(), buf);
if (nc->pass.equals_cs(buf))
{
/* if we are NOT the first module in the list,
* we want to re-encrypt the pass with the new encryption
*/
if (ModuleManager::FindFirstOf(ENCRYPTION) != this)
- enc_encrypt(password, nc->pass);
- return EVENT_ALLOW;
+ enc_encrypt(req->GetPassword(), nc->pass);
+ req->Success(this);
}
-
- return EVENT_CONTINUE;
}
};
diff --git a/modules/encryption/enc_none.cpp b/modules/encryption/enc_none.cpp
index 778ed6cba..9496939fd 100644
--- a/modules/encryption/enc_none.cpp
+++ b/modules/encryption/enc_none.cpp
@@ -41,33 +41,31 @@ class ENone : public Module
return EVENT_ALLOW;
}
- EventReturn OnCheckAuthentication(Command *c, CommandSource *source, const std::vector<Anope::string> &params, const Anope::string &account, const Anope::string &password) anope_override
+ void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override
{
- const NickAlias *na = findnick(account);
+ const NickAlias *na = findnick(req->GetAccount());
if (na == NULL)
- return EVENT_CONTINUE;
+ return;
NickCore *nc = na->nc;
size_t pos = nc->pass.find(':');
if (pos == Anope::string::npos)
- return EVENT_CONTINUE;
+ return;
Anope::string hash_method(nc->pass.begin(), nc->pass.begin() + pos);
if (!hash_method.equals_cs("plain"))
- return EVENT_CONTINUE;
+ return;
Anope::string buf;
- this->OnEncrypt(password, buf);
+ this->OnEncrypt(req->GetPassword(), buf);
if (nc->pass.equals_cs(buf))
{
/* if we are NOT the first module in the list,
* we want to re-encrypt the pass with the new encryption
*/
if (ModuleManager::FindFirstOf(ENCRYPTION) != this)
- enc_encrypt(password, nc->pass);
- return EVENT_ALLOW;
+ enc_encrypt(req->GetPassword(), nc->pass);
+ req->Success(this);
}
-
- return EVENT_CONTINUE;
}
};
diff --git a/modules/encryption/enc_old.cpp b/modules/encryption/enc_old.cpp
index 9fba199dc..b5ce86540 100644
--- a/modules/encryption/enc_old.cpp
+++ b/modules/encryption/enc_old.cpp
@@ -349,33 +349,31 @@ class EOld : public Module
return EVENT_ALLOW;
}
- EventReturn OnCheckAuthentication(Command *c, CommandSource *source, const std::vector<Anope::string> &params, const Anope::string &account, const Anope::string &password) anope_override
+ void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override
{
- const NickAlias *na = findnick(account);
+ const NickAlias *na = findnick(req->GetAccount());
if (na == NULL)
- return EVENT_CONTINUE;
+ return;
NickCore *nc = na->nc;
size_t pos = nc->pass.find(':');
if (pos == Anope::string::npos)
- return EVENT_CONTINUE;
+ return;
Anope::string hash_method(nc->pass.begin(), nc->pass.begin() + pos);
if (!hash_method.equals_cs("oldmd5"))
- return EVENT_CONTINUE;
+ return;
Anope::string buf;
- this->OnEncrypt(password, buf);
+ this->OnEncrypt(req->GetPassword(), buf);
if (nc->pass.equals_cs(buf))
{
/* if we are NOT the first module in the list,
* we want to re-encrypt the pass with the new encryption
*/
if (ModuleManager::FindFirstOf(ENCRYPTION) != this)
- enc_encrypt(password, nc->pass);
- return EVENT_ALLOW;
+ enc_encrypt(req->GetPassword(), nc->pass);
+ req->Success(this);
}
-
- return EVENT_CONTINUE;
}
};
diff --git a/modules/encryption/enc_sha1.cpp b/modules/encryption/enc_sha1.cpp
index 3735e65bc..28d216972 100644
--- a/modules/encryption/enc_sha1.cpp
+++ b/modules/encryption/enc_sha1.cpp
@@ -192,30 +192,28 @@ class ESHA1 : public Module
return EVENT_ALLOW;
}
- EventReturn OnCheckAuthentication(Command *c, CommandSource *source, const std::vector<Anope::string> &params, const Anope::string &account, const Anope::string &password) anope_override
+ void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override
{
- const NickAlias *na = findnick(account);
+ const NickAlias *na = findnick(req->GetAccount());
if (na == NULL)
- return EVENT_CONTINUE;
+ return;
NickCore *nc = na->nc;
size_t pos = nc->pass.find(':');
if (pos == Anope::string::npos)
- return EVENT_CONTINUE;
+ return;
Anope::string hash_method(nc->pass.begin(), nc->pass.begin() + pos);
if (!hash_method.equals_cs("sha1"))
- return EVENT_CONTINUE;
+ return;
Anope::string buf;
- this->OnEncrypt(password, buf);
+ this->OnEncrypt(req->GetPassword(), buf);
if (nc->pass.equals_cs(buf))
{
if (ModuleManager::FindFirstOf(ENCRYPTION) != this)
- enc_encrypt(password, nc->pass);
- return EVENT_ALLOW;
+ enc_encrypt(req->GetPassword(), nc->pass);
+ req->Success(this);
}
-
- return EVENT_CONTINUE;
}
};
diff --git a/modules/encryption/enc_sha256.cpp b/modules/encryption/enc_sha256.cpp
index cee21b01d..36eaa98fc 100644
--- a/modules/encryption/enc_sha256.cpp
+++ b/modules/encryption/enc_sha256.cpp
@@ -278,24 +278,24 @@ class ESHA256 : public Module
return EVENT_ALLOW;
}
- EventReturn OnCheckAuthentication(Command *c, CommandSource *source, const std::vector<Anope::string> &params, const Anope::string &account, const Anope::string &password) anope_override
+ void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override
{
- const NickAlias *na = findnick(account);
+ const NickAlias *na = findnick(req->GetAccount());
if (na == NULL)
- return EVENT_CONTINUE;
+ return;
NickCore *nc = na->nc;
size_t pos = nc->pass.find(':');
if (pos == Anope::string::npos)
- return EVENT_CONTINUE;
+ return;
Anope::string hash_method(nc->pass.begin(), nc->pass.begin() + pos);
if (!hash_method.equals_cs("sha256"))
- return EVENT_CONTINUE;
+ return;
GetIVFromPass(nc->pass);
use_iv = true;
Anope::string buf;
- this->OnEncrypt(password, buf);
+ this->OnEncrypt(req->GetPassword(), buf);
if (nc->pass.equals_cs(buf))
{
@@ -303,11 +303,9 @@ class ESHA256 : public Module
* we want to re-encrypt the pass with the new encryption
*/
if (ModuleManager::FindFirstOf(ENCRYPTION) != this)
- enc_encrypt(password, nc->pass);
- return EVENT_ALLOW;
+ enc_encrypt(req->GetPassword(), nc->pass);
+ req->Success(this);
}
-
- return EVENT_CONTINUE;
}
};