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

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -