从OpenLDAP中检索操作属性

我一直在尝试find一些关于如何从OpenLDAP检索操作属性的好文档。

我想通过LDAPsearch来检索LDAP服务器的基本专有名称。

当我明确要求namingContexts属性时,我的search怎么不起作用? 我被告知我需要给属性列表添加一个加号('+')。

如果是这样的话,我应该摆脱“namingContexts”属性还是同时具有?

ldapsearch -H ldap://ldap.mydomain.com -x -s base -b "" + # note the + returns operational attributes 

编辑:请注意它看起来像所请求的属性是空的。 加号不应该在属性列表中? http://www.zytrax.com/books/ldap/ch3/#operational

参考: 使用OpenLDAP的加号运算符

当我明确要求namingContexts属性时,我的search怎么不起作用?

什么不工作? 你收到一个错误?

当有加号时,无论是否添加了namingContext,它都会返回所有的属性。

使用:

 ldapsearch -x -H ldap://ldap.example.com -s base -b "" namingContexts 

返回:

 # extended LDIF # # LDAPv3 # base <> with scope baseObject # filter: (objectclass=*) # requesting: namingContexts # # dn: namingContexts: o=example.com # search result search: 2 result: 0 Success # numResponses: 2 # numEntries: 1 

它也被列入使用:

 ldapsearch -x -H ldap://ldap.example.com -s base -b "" + 

返回:

 # extended LDIF # # LDAPv3 # base <> with scope baseObject # filter: (objectclass=*) # requesting: + # # dn: structuralObjectClass: OpenLDAProotDSE namingContexts: o=example.com supportedControl: 2.16.840.1.113730.3.4.18 supportedControl: 2.16.840.1.113730.3.4.2 supportedControl: 1.3.6.1.4.1.4203.1.10.1 supportedControl: 1.2.840.113556.1.4.1413 supportedControl: 1.2.840.113556.1.4.1339 supportedControl: 1.2.840.113556.1.4.319 supportedControl: 1.2.826.0.1.334810.2.3 supportedExtension: 1.3.6.1.4.1.1466.20037 supportedExtension: 1.3.6.1.4.1.4203.1.11.1 supportedExtension: 1.3.6.1.4.1.4203.1.11.3 supportedFeatures: 1.3.6.1.4.1.4203.1.5.1 supportedFeatures: 1.3.6.1.4.1.4203.1.5.2 supportedFeatures: 1.3.6.1.4.1.4203.1.5.3 supportedFeatures: 1.3.6.1.4.1.4203.1.5.4 supportedFeatures: 1.3.6.1.4.1.4203.1.5.5 supportedLDAPVersion: 2 supportedLDAPVersion: 3 supportedSASLMechanisms: DIGEST-MD5 supportedSASLMechanisms: CRAM-MD5 subschemaSubentry: cn=Subschema # search result search: 2 result: 0 Success # numResponses: 2 # numEntries: 1 

你使用的是什么版本的OpenLDAP? “不起作用”是什么意思? 运行该命令时的输出是什么?

我在OpenLDAP实例上运行它,并产生类似于carrell的输出。

我想知道如果这可能是一个权限问题。 也许匿名用户对dn =“”没有读访问权限,或者访问有问题的操作属性?

我的slapd.conf中的第一个访问规则是明确的,以确保这是允许的; 确保你有类似的东西:

 # Let all clients figure out what auth mechanisms are available, determine # that TLS is okay, etc access to dn.base="" by * read