diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2015-04-23 12:03:49 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2015-05-07 18:13:57 +0200 |
commit | 7d10547ae3098b96762846ff36e813042a503d59 (patch) | |
tree | 226c200c3495a7e38653f4d9a9344d04108278f2 | |
parent | b88f5333ec039cf8a40c0377323554a451730ac7 (diff) | |
download | freeipa-7d10547ae3098b96762846ff36e813042a503d59.tar.gz freeipa-7d10547ae3098b96762846ff36e813042a503d59.tar.xz freeipa-7d10547ae3098b96762846ff36e813042a503d59.zip |
allow to call ldap2.destroy_connection multiple times
A regression fix.
Reviewed-By: Nathaniel McCallum <npmccallum@redhat.com>
-rw-r--r-- | ipapython/ipaldap.py | 2 | ||||
-rw-r--r-- | ipaserver/plugins/ldap2.py | 5 |
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 |