summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipapython/ipaldap.py2
-rw-r--r--ipaserver/plugins/ldap2.py5
2 files changed, 4 insertions, 3 deletions
diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py
index 75ff2177b..ef7c41a37 100644
--- a/ipapython/ipaldap.py
+++ b/ipapython/ipaldap.py
@@ -1089,7 +1089,7 @@ class LDAPClient(object):
"""
with self.error_handler():
self._flush_schema()
- self.conn.unbind_s()
+ self._conn.unbind_s()
def make_dn_from_attr(self, attr, value, parent_dn=None):
"""
diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py
index d1d966c59..36a6fedda 100644
--- a/ipaserver/plugins/ldap2.py
+++ b/ipaserver/plugins/ldap2.py
@@ -196,8 +196,9 @@ class ldap2(LDAPClient, CrudBackend):
def destroy_connection(self):
"""Disconnect from LDAP server."""
try:
- self.unbind()
- LDAPClient._disconnect(self)
+ if self._conn is not None:
+ self.unbind()
+ LDAPClient._disconnect(self)
except errors.PublicError:
# ignore when trying to unbind multiple times
pass