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