我们使用类似于下面的代码来建立到LDAP目录的安全连接:
using (LdapConnection con = new LdapConnection(new LdapDirectoryIdentifier(ConfigReader.ADServer, 636)))
{
con.SessionOptions.SecureSocketLayer = true;
con.SessionOptions.VerifyServerCertificate = new VerifyServerCertificateCallback(ServerCallback);
con.Credential = new NetworkCredential(UserDN, UserPwd);
con.AuthType = AuthType.Basic;
con.Bind();
}在测试过程中,我们注意到了以下预期行为:
不幸的是,我们还注意到以下意外行为:
请说明为什么使用空白密码LDAP连接是成功的。
谢谢,
发布于 2013-08-28 18:30:14
似乎连接是绑定的,但在发送实际请求之前不进行身份验证。
考虑以下在绑定连接后发送请求.
using (LdapConnection con = new LdapConnection(new LdapDirectoryIdentifier(ConfigReader.ADServer, 636)))
{
con.SessionOptions.SecureSocketLayer = true;
con.SessionOptions.VerifyServerCertificate = new VerifyServerCertificateCallback(ServerCallback);
con.Credential = new NetworkCredential(UserDN, UserPwd);
con.AuthType = AuthType.Basic;
con.Bind();
**con.SendRequest(new SearchRequest(targetLocation, "(objectClass=*)", System.DirectoryServices.Protocols.SearchScope.Subtree, null));**
}https://stackoverflow.com/questions/18384797
复制相似问题