python - What does this mean: "unable to send message, socket is not open"? -


i'm trying connect ldap server, seems failing in someway or form:

import csv ldap3 import server, connection, all, ntlm, subtree import pandas pd   server = server('cybertest02.ad.arb.ca.gov', get_info=all) c = connection(server, user='myusername', password='mypassword')  c.search(search_base = 'o=test',          search_filter = '(objectclass=inetorgperson)',          search_scope = subtree,          attributes = ['cn', 'givenname'])  total_entries += len(c.response) entry in c.response:     print(entry['dn'], entry['attributes']) 

error on line 12: attributes is, unable send message, socket not open

try inserting c.bind() before c.search() , after connection() statements.

according ldap3 docs, must bind() establish new authorization state in server.

  • as specified in rfc4511 bind operation “authenticate” operation.

  • when open connection ldap server you’re in anonymous connection state. means defined server implementation, not protocol.

  • the bind() method open connection if not open.

  • the bind operation instead has nothing socket, performs user’s authentication.

also should use c.unbind() close connection.


Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

c# - Populating Gridview inside Listview ItemTemplate On Web User Control from Code Behind -