ldapsearch过滤器与DN

huangapple go评论51阅读模式
英文:

ldapsearch filter with dn

问题

我想要从ldapsearch中搜索提到的实体:

ldapsearch -LLL -x -H ldaps://ldapserver -E pr=1000/noprompt -b "O=XXX,C=AN" "(dn=cn=firstName lastName 1231233,ou=employee,o=xxx,c=an)"

我得到的输出是:

# pagedresults: cookie=

但是当我使用其别名搜索相同的实体时,我从命令中得到了整个对象的返回。

那么,为什么我没有从提到的命令中得到返回呢?

我想在dn字段上进行过滤,如上所述,我从别名搜索字段中得到了相同的dn。所以理论上,如果我使用正确的方式进行过滤,我应该会得到结果。

请告诉我如果我在过滤查询中有任何错误。

英文:

I wanted to search for mentioned entity from the ldapsearch:

ldapsearch -LLL -x -H ldaps://ldapserver -E pr=1000/noprompt -b "O=XXX,C=AN " "(dn=cn=firstName lastName  1231233,ou=employee,o=xxx,c=an)"

I get the output as

# pagedresults: cookie=

But when i search the same entity with its alias name, I am getting the whole object return from the command.

So, why I am not getting the return from the mentioned command.

I wanted to do the filter on the dn field from the as already mentioned and the same dn I got from the alias search field. So ideally I should get the result if I used the correct way to filter.

Please let me know if I made any mistake on the filter query.

答案1

得分: 2

你可以通过其 DN 访问条目,使用以下命令(可能是 @user207421 建议的方式):

ldapsearch -LLL -x -H ldaps://ldapserver -b "cn=firstName lastName 1231233,ou=employee,o=xxx,c=an" -s base

关键是将搜索的条目设置为适当的范围,即base

英文:

You can access the entry by its dn using the following (probably what @user207421 suggested) :

ldapsearch -LLL -x -H ldaps://ldapserver -b "cn=firstName lastName  1231233,ou=employee,o=xxx,c=an" -s base

The key is to set the searched entry as the base with the appropriate scope, that is base.

huangapple
  • 本文由 发表于 2020年1月3日 16:31:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/59575334.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定