summaryrefslogtreecommitdiff
path: root/src/modules/m_ldapauth.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2017-03-20 13:10:07 -0400
committerAdam <Adam@anope.org>2017-03-20 13:10:07 -0400
commitec4c5f0bb6c0563730ad83f6159c4bff33520f4a (patch)
tree0ef9f2126c8fbf6990399721f471ac7482b7c655 /src/modules/m_ldapauth.cpp
parent5583d8dc5ff202d411d7985b6bbfb240beeacddd (diff)
m_ldapauth: use username provided in PASS if available
Diffstat (limited to 'src/modules/m_ldapauth.cpp')
-rw-r--r--src/modules/m_ldapauth.cpp15
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)