At first I thought there was a problem with the LdapHelper. But it might be with the way the user id is retrieved or stored.
First the problem:
I was setting up LDAP on the SiteSettings.aspx page. It was not working. So I followed the code on CodePlex. The following line caught my eye. So I downloaded the full code and put a break in it. And sure enough that line caused the error. My uid has the domain in it. And the following code appends then domain on the end. So it is trying to the bind with 'domain\userid@domain' that is causing the error.
// this works with Active Directory
conn.Bind(uid + "@" + ldapSettings.Domain, password);
So this line in SiteSettings.aspx.cs, function TestCurrentUserLdap, sets the uid to 'domain\userid'.
private bool TestCurrentUserLdap(LdapSettings testLdapSettings)
{
--> String uid = Context.User.Identity.Name;
SiteUser user = new SiteUser(this.selectedSite, uid);
return LdapHelper.TestUser(testLdapSettings, user.LoginName, txtLdapTestPassword.Text);
}
(both uid and user.LoginName = 'domain/userid')
To fix this, I think the GetUser function in SiteUser class could test if uid contains a slash and remove the domain and slash. That way it does not get stored in the database and the LDAP should work as designed.
Change set = 08b9e72fe613