summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2014-11-21 20:03:29 +0100
committerJan Cholasta <jcholast@redhat.com>2015-04-16 06:58:31 +0000
commit8f263df2456c6c2ba4463c690bb69b3650356493 (patch)
tree04282782f429a480aa1bd740d659fc990495ffad
parent45d9b82f404128926102750e28503de2b768cf9d (diff)
downloadfreeipa-8f263df2456c6c2ba4463c690bb69b3650356493.tar.gz
freeipa-8f263df2456c6c2ba4463c690bb69b3650356493.tar.xz
freeipa-8f263df2456c6c2ba4463c690bb69b3650356493.zip
ldap: Use LDAPClient connection management in ldap2
Reviewed-By: Petr Viktorin <pviktori@redhat.com>
-rw-r--r--ipaserver/plugins/ldap2.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py
index 267157146..98b038ab9 100644
--- a/ipaserver/plugins/ldap2.py
+++ b/ipaserver/plugins/ldap2.py
@@ -145,10 +145,12 @@ class ldap2(LDAPClient, CrudBackend):
if debug_level:
_ldap.set_option(_ldap.OPT_DEBUG_LEVEL, debug_level)
+ object.__setattr__(self, '_force_schema_updates',
+ self.api.env.context in ('installer', 'updates'))
+ LDAPClient._connect(self)
+ conn = self._conn
+
with self.error_handler():
- force_updates = self.api.env.context in ('installer', 'updates')
- conn = IPASimpleLDAPObject(
- self.ldap_uri, force_schema_updates=force_updates)
if self.ldap_uri.startswith('ldapi://') and ccache:
conn.set_option(_ldap.OPT_HOST_NAME, self.api.env.host)
minssf = conn.get_option(_ldap.OPT_X_SASL_SSF_MIN)
@@ -200,6 +202,11 @@ class ldap2(LDAPClient, CrudBackend):
# ignore when trying to unbind multiple times
pass
+ try:
+ LDAPClient._disconnect(self)
+ except errors.PublicError:
+ # ignore when trying to unbind multiple times
+ pass
def find_entries(self, filter=None, attrs_list=None, base_dn=None,
scope=_ldap.SCOPE_SUBTREE, time_limit=None,