我正在尝试运行试图建立连接的代码:
server = Server(host='localhost', port=33389, use_ssl=False, get_info=ALL)
conn = Connection(server, user='uid=admin,ou=people,dc=example,dc=org', password=user-pass, raise_exceptions=False, authentication=SIMPLE)
print(server.info)
print(conn)
以下是错误详情:
None
ldap://localhost:33389 - cleartext - user: uid=admin,ou=people,dc=hadoop,dc=apache,dc=org - not lazy - unbound - closed - <no socket> - tls not started - not listening - SyncStrategy - internal decoder
**************************
Traceback (most recent call last):
File "knox_connect.py", line 116, in <module>
main()
File "knox_connect.py", line 112, in main
print(get_knox_users())
File "knox_connect.py", line 63, in get_knox_users
conn.open()
File "/usr/local/lib/python3.5/dist-packages/ldap3/strategy/sync.py", line 59, in open
self.connection.refresh_server_info()
File "/usr/local/lib/python3.5/dist-packages/ldap3/core/connection.py", line 1325, in refresh_server_info
self.server.get_info_from_server(self)
File "/usr/local/lib/python3.5/dist-packages/ldap3/core/server.py", line 448, in get_info_from_server
self._get_dsa_info(connection)
File "/usr/local/lib/python3.5/dist-packages/ldap3/core/server.py", line 364, in _get_dsa_info
get_operational_attributes=True)
File "/usr/local/lib/python3.5/dist-packages/ldap3/core/connection.py", line 775, in search
response = self.post_send_search(self.send('searchRequest', request, controls))
File "/usr/local/lib/python3.5/dist-packages/ldap3/strategy/sync.py", line 142, in post_send_search
responses, result = self.get_response(message_id)
File "/usr/local/lib/python3.5/dist-packages/ldap3/strategy/base.py", line 345, in get_response
raise LDAPSessionTerminatedByServerError(self.connection.last_error)
ldap3.core.exceptions.LDAPSessionTerminatedByServerError: session terminated by server
有关错误的任何想法吗?
答案 0 :(得分:0)
在阅读信息之前,您必须使用conn.bind()方法打开连接。