From 70e57179d3cffea758166609bffac2a804ef7074 Mon Sep 17 00:00:00 2001
From: Andreas <andreasv@fsmpi.rwth-aachen.de>
Date: Sun, 9 Oct 2016 18:47:21 +0200
Subject: [PATCH] fixed ldap for ancient ldap3 versions... thanks debian

---
 db.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/db.py b/db.py
index bdbfb7b..b1340c1 100644
--- a/db.py
+++ b/db.py
@@ -114,7 +114,7 @@ if 'LDAP_HOST' in config:
 		try:
 			conn = ldap3.Connection(config['LDAP_HOST'], 'uid=%s,ou=users,dc=fsmpi,dc=rwth-aachen,dc=de'%user, password, auto_bind=True)
 			if conn.search("ou=groups,dc=fsmpi,dc=rwth-aachen,dc=de", "(&(cn=*)(memberUid=%s))"%user, attributes=['cn']):
-				groups = [e.cn.value for e in conn.entries]
+				groups = [e['attributes']['cn'][0] for e in conn.response]
 			conn.unbind()
 			return user, groups
 		except ldap3.core.exceptions.LDAPBindError:
@@ -127,8 +127,8 @@ if 'LDAP_HOST' in config:
 				attributes=ldap3.ALL_ATTRIBUTES)
 		if not conn.entries:
 			return {}
-		e = conn.entries[0]
-		return {'uid': user, 'givenName': e.givenName.value, 'sn':e.sn.value}
+		e = conn.response[0]
+		return {'uid': user, 'givenName': e['attributes']['givenName'][0], 'sn':e['attributes']['sn'][0]}
 
 else:
 	notldap = {
-- 
GitLab