summaryrefslogtreecommitdiff
path: root/modules/extra/m_ldap_authentication.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-09-07 06:52:56 -0400
committerAdam <Adam@anope.org>2012-09-07 06:52:56 -0400
commit306037525181b3e4aad1f53cea2b3f46603d77a2 (patch)
treeb50be743020a84a222a70996ba79cf83571ade99 /modules/extra/m_ldap_authentication.cpp
parent3c63e44d32edcced83c88fc7d06e33d40791b781 (diff)
Fixed m_ldap_authentication not returning anything if the search for an account game back empty
Diffstat (limited to 'modules/extra/m_ldap_authentication.cpp')
-rw-r--r--modules/extra/m_ldap_authentication.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp
index 8a42553e5..0f0593c34 100644
--- a/modules/extra/m_ldap_authentication.cpp
+++ b/modules/extra/m_ldap_authentication.cpp
@@ -57,17 +57,32 @@ class IdentifyInterface : public LDAPInterface
{
case LDAPResult::QUERY_SEARCH:
{
- try
+ if (!r.empty())
{
- const LDAPAttributes &attr = r.get(0);
- ii->dn = attr.get("dn");
- Log(LOG_DEBUG) << "m_ldap_authenticationn: binding as " << ii->dn;
- LDAPQuery id = ii->lprov->Bind(this, ii->dn, ii->pass);
- this->Add(id, ii);
+ try
+ {
+ const LDAPAttributes &attr = r.get(0);
+ ii->dn = attr.get("dn");
+ Log(LOG_DEBUG) << "m_ldap_authenticationn: binding as " << ii->dn;
+ LDAPQuery id = ii->lprov->Bind(this, ii->dn, ii->pass);
+ this->Add(id, ii);
+ }
+ catch (const LDAPException &ex)
+ {
+ Log() << "m_ldap_authentication: Error binding after search: " << ex.GetReason();
+ delete ii;
+ }
}
- catch (const LDAPException &ex)
+ else
{
- Log() << "m_ldap_authentication: Error binding after search: " << ex.GetReason();
+ User *u = ii->user;
+ Command *c = ii->command;
+
+ u->Extend("m_ldap_authentication_error", NULL);
+
+ c->Execute(ii->source, ii->params);
+
+ delete ii;
}
break;
}