diff options
author | Adam <Adam@anope.org> | 2012-05-15 04:27:36 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-05-15 04:27:36 -0400 |
commit | 90b028316047d76ae5ee4b2293b4947ac90f7750 (patch) | |
tree | 19299976856b86df6c105858645a3b5a0de3448c /modules/extra/m_ldap.cpp | |
parent | 0a8d46b538e14d358c80501c317ed9610f1fa508 (diff) |
Grab the DN for every LDAP query and send it in the result
Diffstat (limited to 'modules/extra/m_ldap.cpp')
-rw-r--r-- | modules/extra/m_ldap.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/extra/m_ldap.cpp b/modules/extra/m_ldap.cpp index 67a433bbd..a2bbcf655 100644 --- a/modules/extra/m_ldap.cpp +++ b/modules/extra/m_ldap.cpp @@ -240,9 +240,13 @@ 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; + if (dn != NULL) + attributes["dn"].push_back(dn); + switch (cur_type) { case LDAP_RES_BIND: @@ -250,7 +254,6 @@ class LDAPService : public LDAPProvider, public Thread, public Condition break; case LDAP_RES_SEARCH_ENTRY: ldap_result->type = LDAPResult::QUERY_SEARCH; - case LDAP_RES_SEARCH_RESULT: break; case LDAP_RES_ADD: ldap_result->type = LDAPResult::QUERY_ADD; @@ -261,6 +264,8 @@ class LDAPService : public LDAPProvider, public Thread, public Condition case LDAP_RES_MODIFY: ldap_result->type = LDAPResult::QUERY_MODIFY; break; + case LDAP_RES_SEARCH_RESULT: + break; /* Ignore this */ default: Log(LOG_DEBUG) << "m_ldap: Unknown msg type " << cur_type; continue; @@ -316,6 +321,9 @@ class LDAPService : public LDAPProvider, public Thread, public Condition } ldap_result->messages.push_back(attributes); + + if (dn != NULL) + ldap_memfree(dn); } ldap_msgfree(result); |