Patch attached

From 93a88da9dabc3037d3e303cb4b91699b5fcf26d1 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Wed, 18 May 2016 18:51:04 +0200
Subject: [PATCH] Fix referenced before assigment variables in except
 statements

Variable msg may not exists in the last except context, and even it
contains improper value because it is not related to catched exception
---
 ipalib/plugins/baseldap.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index a1daa116a006feb27eb5f7d4390208504329603f..47f42ce34d90f76f33a1e70c4d02a2743d20ab98 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -2242,7 +2242,7 @@ class LDAPAddReverseMember(LDAPModReverseMember):
                     failed['member'][self.reverse_attr].append((attr, unicode(msg.strip())))
 
             except errors.PublicError as e:
-                failed['member'][self.reverse_attr].append((attr, unicode(msg)))
+                failed['member'][self.reverse_attr].append((attr, unicode(e)))
 
         # Update the member data.
         entry_attrs = ldap.get_entry(dn, ['*'])
@@ -2343,7 +2343,7 @@ class LDAPRemoveReverseMember(LDAPModReverseMember):
                     failed['member'][self.reverse_attr].append((attr, unicode(msg.strip())))
 
             except errors.PublicError as e:
-                failed['member'][self.reverse_attr].append((attr, unicode(msg)))
+                failed['member'][self.reverse_attr].append((attr, unicode(e)))
 
         # Update the member data.
         entry_attrs = ldap.get_entry(dn, ['*'])
-- 
2.5.5

-- 
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