If unbind was called when disconnected it raised:
  AttributeError: 'NoneType' object has no attribute 'unbind_s'

AttributeError is not a public error and therefore it prevented
ldap2.destroy_connection() to be called multiple times.

fixes:
https://fedorahosted.org/freeipa/ticket/4991

Note: this issue also prevented rpcserver.change_password from working. Therefore I think that there might have been an error in recent ipaldap refactoring and if #4991 was not run on master then there might have been other issue, which probably have been fixed by the refactoring.
--
Petr Vobornik
From 5d5d9dffab33058c7469a2da749ea99d1c6d7024 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Thu, 23 Apr 2015 12:03:49 +0200
Subject: [PATCH] ipaldap: raise DatabaseError on unbind if disconnected

If unbind was called when disconnected it raised:
  AttributeError: 'NoneType' object has no attribute 'unbind_s'

AttributeError is not a public error and therefore it prevented
ldap2.destroy_connection() to be called multiple times.

fixes:

https://fedorahosted.org/freeipa/ticket/4991
---
 ipapython/ipaldap.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py
index 7cda7d67d1174cddbff646fd7133a9b995cb58a2..9153cfb97f471bf261cca09b4d4a8265aa1641cf 100644
--- a/ipapython/ipaldap.py
+++ b/ipapython/ipaldap.py
@@ -1087,7 +1087,10 @@ class LDAPClient(object):
         """
         with self.error_handler():
             self._flush_schema()
-            self.conn.unbind_s()
+            if self._conn is None:
+                raise errors.DatabaseError(
+                    desc="Can't unbind", info="Not connected")
+            self._conn.unbind_s()
 
     def make_dn_from_attr(self, attr, value, parent_dn=None):
         """
-- 
2.1.0

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to