0

I am getting this error while searching a user with "uid" with python ldap3 module

Error:

Traceback (most recent call last):
  File "/Users/robinmalhotra/PycharmProjects/pythonProject/main.py", line 6, in <module>
    print(c.extend.standard.who_am_i())
  File "/Users/robinmalhotra/.local/share/virtualenvs/pythonProject-AY4VAyDV/lib/python3.9/site-packages/ldap3/extend/__init__.py", line 65, in who_am_i
    return WhoAmI(self._connection,
  File "/Users/robinmalhotra/.local/share/virtualenvs/pythonProject-AY4VAyDV/lib/python3.9/site-packages/ldap3/extend/operation.py", line 53, in send
    resp = self.connection.extended(self.request_name, self.request_value, self.controls)
  File "/Users/robinmalhotra/.local/share/virtualenvs/pythonProject-AY4VAyDV/lib/python3.9/site-packages/ldap3/core/connection.py", line 1275, in extended
    response = self.post_send_single_response(self.send('extendedReq', request, controls))
  File "/Users/robinmalhotra/.local/share/virtualenvs/pythonProject-AY4VAyDV/lib/python3.9/site-packages/ldap3/strategy/base.py", line 336, in send
    raise LDAPSocketOpenError(self.connection.last_error)
ldap3.core.exceptions.LDAPSocketOpenError: unable to send message, socket is not open

Here is my Script:

 from ldap3 import Server, Connection, ALL
    
    s = Server(host='oimdevsand', port=389, use_ssl=False, get_info='ALL')
    c = Connection(s, user='uid=idmsa,ou=People,ou=auth,o=ABX', password='XYZ', auto_bind='NONE', version=3, authentication='SIMPLE', \
    client_strategy='SYNC', auto_referrals=True, check_names=True, read_only=False, lazy=False, raise_exceptions=False)
    print(c.extend.standard.who_am_i())
    c.search("ABC","o=abc","(uid=abc)")
    print(c.entries)
blazej
  • 927
  • 4
  • 11
  • 21
  • Do verify your LDAP setup. It might be misconfigured. Try with something like phpldapadmin. Try to check ldap logs. – Nishan Paudel Jun 30 '21 at 06:52
  • Thanks its done can you tell me how do I search a uid number greater than a particular number. For example if I wanna search a uid number greater than 2147483647 how do I write it in a script? – Robin Malhotra Jul 02 '21 at 18:44

0 Answers0