summaryrefslogtreecommitdiff
path: root/modules/extra/m_ldap_authentication.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-07-01 22:17:52 -0400
committerAdam <Adam@anope.org>2013-07-01 22:17:52 -0400
commit1a3d9a016d3adc49788bbff73aac9b3b5ea85b17 (patch)
treec0ecf92ed768473bc82ff64a7fce827245f37ba9 /modules/extra/m_ldap_authentication.cpp
parent518182ac9204f815258b0de91b3f884d8efa1502 (diff)
Change extensible keys to require explicitly having a type defined for it. Completely modularize more features like bs_kick, entrymsg, log, mode, etc. Move fantasy to its own module. Move greet to its own module.
Diffstat (limited to 'modules/extra/m_ldap_authentication.cpp')
-rw-r--r--modules/extra/m_ldap_authentication.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp
index d64987ed6..7fe44b8e0 100644
--- a/modules/extra/m_ldap_authentication.cpp
+++ b/modules/extra/m_ldap_authentication.cpp
@@ -111,7 +111,7 @@ class IdentifyInterface : public LDAPInterface
// encrypt and store the password in the nickcore
Anope::Encrypt(ii->req->GetPassword(), na->nc->pass);
- na->nc->Extend("m_ldap_authentication_dn", new ExtensibleItemClass<Anope::string>(ii->dn));
+ na->nc->Extend<Anope::string>("m_ldap_authentication_dn", ii->dn);
ii->req->Success(me);
}
break;
@@ -207,12 +207,15 @@ class NSIdentifyLDAP : public Module
OnIdentifyInterface oninterface;
OnRegisterInterface orinterface;
+ PrimitiveExtensibleItem<Anope::string> dn;
+
Anope::string password_attribute;
Anope::string disable_register_reason;
Anope::string disable_email_reason;
public:
NSIdentifyLDAP(const Anope::string &modname, const Anope::string &creator) :
- Module(modname, creator, EXTRA | VENDOR), ldap("LDAPProvider", "ldap/main"), iinterface(this), oninterface(this), orinterface(this)
+ Module(modname, creator, EXTRA | VENDOR), ldap("LDAPProvider", "ldap/main"), iinterface(this), oninterface(this), orinterface(this),
+ dn(this, "m_ldap_authentication_dn")
{
me = this;
@@ -274,16 +277,16 @@ class NSIdentifyLDAP : public Module
void OnNickIdentify(User *u) anope_override
{
- if (email_attribute.empty() || !this->ldap || !u->Account()->HasExt("m_ldap_authentication_dn"))
+ if (email_attribute.empty() || !this->ldap)
return;
- Anope::string *dn = u->Account()->GetExt<ExtensibleItemClass<Anope::string> *>("m_ldap_authentication_dn");
- if (!dn || dn->empty())
+ Anope::string *d = dn.Get(u->Account());
+ if (!d || d->empty())
return;
try
{
- LDAPQuery id = this->ldap->Search(&this->oninterface, *dn, "(" + email_attribute + "=*)");
+ LDAPQuery id = this->ldap->Search(&this->oninterface, *d, "(" + email_attribute + "=*)");
this->oninterface.Add(id, u->nick);
}
catch (const LDAPException &ex)