Score:0

how to get rid off raise at python3-ldap3

vn flag

Using: ubuntu22.04 python3-ldap3-2.8.1-1

Code:

conn = Connection(server, user=user, password=password, auto_bind=AUTO_BIND_TLS_BEFORE_BIND, raise_exceptions=False)

     conn.start_tls()
     if not conn.bind():
         print('não conectou')
         return False
     return True

If I try a user w/ a valid password it all goes write, but if I use a wrong password openldap stops with this error:

conn = Connection(server, user=user, password=password, auto_bind=AUTO_BIND_TLS_BEFORE_BIND, raise_exceptions=False)

File "/usr/lib/python3/dist-packages/ldap3/core/connection.py", line 356, in init self._do_auto_bind() File "/usr/lib/python3/dist-packages/ldap3/core/connection.py", line 385, in _do_auto_bind self.bind(read_server_info=True) File "/usr/lib/python3/dist-packages/ldap3/core/connection.py", line 600, in bind response = self.post_send_single_response(self.send('bindRequest', request, controls)) File "/usr/lib/python3/dist-packages/ldap3/strategy/sync.py", line 121, in post_send_single_response responses, result = self.get_response(message_id) File "/usr/lib/python3/dist-packages/ldap3/strategy/base.py", line 369, in get_response raise LDAPSessionTerminatedByServerError(self.connection.last_error) ldap3.core.exceptions.LDAPSessionTerminatedByServerError: session terminated by server

Why if I'm using raise_exceptions=False...

How can I test a user + wrong passord without breaking openldap using python3-ldap3? or disable raise exceptions from stopping openldap?

Best regards

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.