给定一个有效的python-ldap
上下文,我如何查询LDAP 服务器中所有可用的objectClass ?我想结果将是一个ldap.schema.models.ObjectClass
.
问问题
224 次
1 回答
0
我终于设法做到了:
import ldap
l = ldap.initialize(ldap_uri)
l.simple_bind_s(ldap_bind_dn, ldap_bind_pw)
res = l.search_s("cn=subschema", ldap.SCOPE_BASE, "(objectclass=*)", ["*", "+"])
subschema_entry = res[0]
subschema_subentry = ldap.cidict.cidict(subschema_entry[1])
subschema = ldap.schema.SubSchema(subschema_subentry)
object_class_oids = subschema.listall(ldap.schema.models.ObjectClass)
object_classes = [
subschema.get_obj(ldap.schema.models.ObjectClass, oid) for oid in object_class_oids
]
于 2020-08-08T13:29:40.657 回答