我正在尝试使用 Python ldap3 从 ldap 检索用户。这是我的设置
from ldap3 import Server, Connection, ObjectDef, AttrDef, Reader, Writer, ALL
server = Server('ldap://ldapserver:389', get_info=ALL)
conn = Connection(server, 'eTGlobalUserName=user,eTGlobalUserContainerName=Global Users,eTNamespaceName=CommonObjects,dc=iam,dc=eta', 'pass123', auto_bind=True)
当我使用连接对象搜索时,我可以检索所有用户:
conn.search('eTGlobalUserContainerName=Global Users,eTNamespaceName=CommonObjects,dc=iam,dc=eta', '(objectclass=eTGlobalUser)')
但是当我尝试让所有用户使用阅读器时,我只得到一个项目,它甚至不包含用户,这就是我所做的:
obj_person = ObjectDef('eTGlobalUser',conn)
r = Reader(conn,obj_person,'eTGlobalUserContainerName=Global Users,eTNamespaceName=CommonObjects,dc=iam,dc=eta')
r.search()
我有什么遗漏吗?
编辑 1 这是 print(r) 的输出:
This is the output of print(r):
CURSOR : Reader
CONN : ldap://ldapserver:389 - cleartext - user: eTGlobalUserName=user,eTGlobalUserContainerName=Global Users,eTNamespaceName=CommonObjects,dc=asusisv-iam,dc=eta - not
lazy - bound - open - <local: 10.150.8.169:54196 - remote: 10.145.10.123:389> - tls not started - listening - SyncStrategy - internal decoder
DEFS : eTGlobalUser
ATTRS : ['eTAccessControlList', ... , 'eTGlobalUserName', ... , 'objectClass']
BASE : 'eTGlobalUserContainerName=Global Users,eTNamespaceName=CommonObjects,dc=iam,dc=eta' [SUB]
FILTER : '(objectClass=eTGlobalUser)'