summaryrefslogtreecommitdiff
path: root/modules/extra/m_ldap_authentication.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-09-15 10:11:31 -0400
committerAdam <Adam@anope.org>2012-09-30 20:30:27 -0400
commit9ba719688161499f01c168b1aed84a563bcb5953 (patch)
treeb2ffbe3ceebf2a32820780fb76d30967af8ea50c /modules/extra/m_ldap_authentication.cpp
parent1e71303ffaf263adb0cc659505caa223f7f27b85 (diff)
Make CommandSource use references, sometimes we hold them for awhile
Diffstat (limited to 'modules/extra/m_ldap_authentication.cpp')
-rw-r--r--modules/extra/m_ldap_authentication.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp
index 0f0593c34..7fcd67e5d 100644
--- a/modules/extra/m_ldap_authentication.cpp
+++ b/modules/extra/m_ldap_authentication.cpp
@@ -10,7 +10,6 @@ static Anope::string username_attribute;
struct IdentifyInfo
{
- dynamic_reference<User> user;
dynamic_reference<Command> command;
CommandSource source;
std::vector<Anope::string> params;
@@ -20,8 +19,8 @@ struct IdentifyInfo
service_reference<LDAPProvider> lprov;
bool admin_bind;
- IdentifyInfo(User *u, Command *c, CommandSource &s, const std::vector<Anope::string> &pa, const Anope::string &a, const Anope::string &p, service_reference<LDAPProvider> &lp) :
- user(u), command(c), source(s), params(pa), account(a), pass(p), lprov(lp), admin_bind(true) { }
+ IdentifyInfo(Command *c, CommandSource &s, const std::vector<Anope::string> &pa, const Anope::string &a, const Anope::string &p, service_reference<LDAPProvider> &lp) :
+ command(c), source(s), params(pa), account(a), pass(p), lprov(lp), admin_bind(true) { }
};
class IdentifyInterface : public LDAPInterface
@@ -47,7 +46,7 @@ class IdentifyInterface : public LDAPInterface
IdentifyInfo *ii = it->second;
this->requests.erase(it);
- if (!ii->user || !ii->command || !ii->lprov)
+ if (!ii->source.GetUser() || !ii->command || !ii->lprov)
{
delete this;
return;
@@ -75,7 +74,7 @@ class IdentifyInterface : public LDAPInterface
}
else
{
- User *u = ii->user;
+ User *u = ii->source.GetUser();
Command *c = ii->command;
u->Extend("m_ldap_authentication_error", NULL);
@@ -98,7 +97,7 @@ class IdentifyInterface : public LDAPInterface
}
else
{
- User *u = ii->user;
+ User *u = ii->source.GetUser();
Command *c = ii->command;
u->Extend("m_ldap_authentication_authenticated", NULL);
@@ -137,13 +136,13 @@ class IdentifyInterface : public LDAPInterface
IdentifyInfo *ii = it->second;
this->requests.erase(it);
- if (!ii->user || !ii->command)
+ if (!ii->source.GetUser() || !ii->command)
{
delete ii;
return;
}
- User *u = ii->user;
+ User *u = ii->source.GetUser();
Command *c = ii->command;
u->Extend("m_ldap_authentication_error", NULL);
@@ -289,7 +288,7 @@ class NSIdentifyLDAP : public Module
return EVENT_CONTINUE;
}
- IdentifyInfo *ii = new IdentifyInfo(u, c, *source, params, account, password, this->ldap);
+ IdentifyInfo *ii = new IdentifyInfo(c, *source, params, account, password, this->ldap);
try
{
LDAPQuery id = this->ldap->BindAsAdmin(&this->iinterface);