From c4a8817176c467e156d5c5aaf7633bc37927fdb4 Mon Sep 17 00:00:00 2001 From: githubuserx Date: Fri, 29 Jul 2022 22:18:37 +0200 Subject: [PATCH] Partially revert changes from 98b4125 Explicitly start TLS connection as it doens't happen automatically. --- django_python3_ldap/ldap.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/django_python3_ldap/ldap.py b/django_python3_ldap/ldap.py index 79640f6..49d9306 100644 --- a/django_python3_ldap/ldap.py +++ b/django_python3_ldap/ldap.py @@ -202,6 +202,9 @@ def connection(**kwargs): return # Configure. try: + # Start TLS, if requested. + if settings.LDAP_AUTH_USE_TLS: + c.start_tls(read_server_info=False) # Perform initial authentication bind. c.bind(read_server_info=True) # If the settings specify an alternative username and password for querying, rebind as that.