summaryrefslogtreecommitdiff
path: root/modules/extra/m_ldap.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.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.cpp')
-rw-r--r--modules/extra/m_ldap.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/modules/extra/m_ldap.cpp b/modules/extra/m_ldap.cpp
index a2bbcf655..e6e65e85c 100644
--- a/modules/extra/m_ldap.cpp
+++ b/modules/extra/m_ldap.cpp
@@ -240,12 +240,16 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
for (LDAPMessage *cur = ldap_first_message(this->con, result); cur; cur = ldap_next_message(this->con, cur))
{
int cur_type = ldap_msgtype(cur);
- char *dn = ldap_get_dn(this->con, cur);
LDAPAttributes attributes;
+ char *dn = ldap_get_dn(this->con, cur);
if (dn != NULL)
+ {
attributes["dn"].push_back(dn);
+ ldap_memfree(dn);
+ dn = NULL;
+ }
switch (cur_type)
{
@@ -265,7 +269,10 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
ldap_result->type = LDAPResult::QUERY_MODIFY;
break;
case LDAP_RES_SEARCH_RESULT:
- break; /* Ignore this */
+ // If we get here and ldap_result->type is LDAPResult::QUERY_UNKNOWN
+ // then the result set is empty
+ ldap_result->type = LDAPResult::QUERY_SEARCH;
+ break;
default:
Log(LOG_DEBUG) << "m_ldap: Unknown msg type " << cur_type;
continue;
@@ -321,9 +328,6 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
}
ldap_result->messages.push_back(attributes);
-
- if (dn != NULL)
- ldap_memfree(dn);
}
ldap_msgfree(result);