From ca40cd317a291090ab4007e82015f8fab93c24e9 Mon Sep 17 00:00:00 2001
From: Sistason <c3infra@sistason.de>
Date: Wed, 10 Mar 2021 01:00:07 +0100
Subject: [PATCH] since we only check on hasattr(request, ldap_connection), we
 must not save None into that.

---
 uffd/ldap.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/uffd/ldap.py b/uffd/ldap.py
index c9aa3838..78018350 100644
--- a/uffd/ldap.py
+++ b/uffd/ldap.py
@@ -73,10 +73,12 @@ class FlaskLDAPMapper(LDAPMapper):
 			bind_dn = session['user_dn']
 			bind_pw = session['user_pw']
 
-		request.ldap_connection = connect_and_bind_to_ldap(server, bind_dn, bind_pw)
-		if not request.ldap_connection:
+		_connection = connect_and_bind_to_ldap(server, bind_dn, bind_pw)
+		if not _connection:
 			raise LDAPBindError
 
+		request.ldap_connection = _connection
+
 		return request.ldap_connection
 
 
-- 
GitLab