【问题标题】:Novell Ldap: missing LdapSearchResult message type in the LdapSearchQueue followint SearchNovell Ldap:LdapSearchQueue 后续搜索中缺少 LdapSearchResult 消息类型
【发布时间】:2021-03-06 16:58:38
【问题描述】:

我首先要说的是,很遗憾,我无法在这种特定情况下更改代码,并且代码在除此安装之外的任何地方都可以使用。我怀疑存在配置/权限/信任问题,我希望获得有关如何修改环境以解决此问题的建议。

在这个特定的地方,在LdapConnection 上运行Search() 方法后,由于某种原因,我得到一个不包含LdapSearchResultLdapSearchQueue。请注意LdapSearchQueue 确实包含其他消息(特别是LdapSearchResultReferenceLdapResponse),而不是LdapSearchResult。我可以手动检查 AD,看看理论上它应该有正确的响应。

显然,它最终以 entrynull

var filter = $"(&(objectClass=User)(sAMAccountName={<user_name>}))";
var searchBase = "DC=<domain_name>,DC=com";
var search = conn.Search(searchBase, LdapConnection.SCOPE_SUB, filter, null, false, null, null);
    LdapMessage message;
    LdapEntry entry = null;
    while ((message = search.getResponse()) != null)
    {
         if (!(message is LdapSearchResult searchResultMessage))
         {
              continue;
         }
         entry = searchResultMessage.Entry;
    }

感谢任何建议

【问题讨论】:

  • 好吧,我们没有看到任何绑定和过滤器。此外,可能根本没有匹配项。您是否尝试过使用具有相同身份验证和过滤器的 LDAP 浏览器?
  • @schnitz77。谢谢..我更新了问题:我没有添加绑定/过滤器,因为它有效/应该有效,但我正在添加过滤器。我还注意到LdapSearchQueue 确实包含其他消息(特别是LdapSearchResultReferenceLdapResponse),而不是LdapSearchResult。我可以手动检查 AD,看看理论上它应该有正确的响应。
  • 谢谢。当您提到 Novell 时,我有点困惑 - 您要查询的是 eDirectory 还是 Active Directory?根据安装的目录扩展,前者不一定有 sAMAccountName。
  • @schnitz77:这是活动目录。如果 AD 未配置为具有 sAMAccountName,那么它会无法在 LdapSearchQueue 中获取任何内容吗?我们确实在搜索结果中收到了一些消息:只是缺少特定消息。
  • 好的,现在知道了,您正在使用 NuGet 包 Novell.Directory.Ldap 查询 Active Directory,很抱歉造成混淆。如果它是 Windows 2000 之前的域,我想您不会得到任何匹配,但这与您的手动检查不匹配。

标签: c# ldap novell


【解决方案1】:

在这种特定情况下,UPN 和 sAMAccountName 属性是不同的(几年前迁移的结果),而通常它们具有相同的值。 UPN 是在客户端应用程序上提供的,用于成功进行身份验证(对于 UPN),但是对 sAMAccountName 使用相同的值会返回错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-28
    • 2019-12-25
    • 1970-01-01
    相关资源
    最近更新 更多