From 306037525181b3e4aad1f53cea2b3f46603d77a2 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 7 Sep 2012 06:52:56 -0400 Subject: Fixed m_ldap_authentication not returning anything if the search for an account game back empty --- modules/extra/m_ldap_authentication.cpp | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'modules/extra/m_ldap_authentication.cpp') 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; } -- cgit