diff options
author | Adam <Adam@anope.org> | 2017-03-20 13:10:07 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-03-20 13:10:07 -0400 |
commit | ec4c5f0bb6c0563730ad83f6159c4bff33520f4a (patch) | |
tree | 0ef9f2126c8fbf6990399721f471ac7482b7c655 | |
parent | 5583d8dc5ff202d411d7985b6bbfb240beeacddd (diff) |
m_ldapauth: use username provided in PASS if available
-rw-r--r-- | src/modules/m_ldapauth.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/modules/m_ldapauth.cpp b/src/modules/m_ldapauth.cpp index 7da63284a..fedf02b4d 100644 --- a/src/modules/m_ldapauth.cpp +++ b/src/modules/m_ldapauth.cpp @@ -406,9 +406,22 @@ public: return MOD_RES_DENY; } + std::string what; + std::string::size_type pos = user->password.find(':'); + if (pos != std::string::npos) + { + what = attribute + "=" + user->password.substr(0, pos); + + // Trim the user: prefix, leaving just 'pass' for later password check + user->password = user->password.substr(pos + 1); + } + else + { + what = attribute + "=" + (useusername ? user->ident : user->nick); + } + try { - std::string what = attribute + "=" + (useusername ? user->ident : user->nick); LDAP->BindAsManager(new AdminBindInterface(this, LDAP.GetProvider(), user->uuid, base, what)); } catch (LDAPException &ex) |