Hi,

the attached patch fixes <https://fedorahosted.org/freeipa/ticket/4138>.

Honza

--
Jan Cholasta
>From 907151a2adae30741a0ac585249e2fa627076f97 Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jchol...@redhat.com>
Date: Tue, 4 Feb 2014 11:39:35 +0100
Subject: [PATCH] Fix modlist generation code not to generate empty replace
 mods.

https://fedorahosted.org/freeipa/ticket/4138
---
 ipapython/ipaldap.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py
index 074e0c2..699bf70 100644
--- a/ipapython/ipaldap.py
+++ b/ipapython/ipaldap.py
@@ -978,12 +978,12 @@ class LDAPEntry(collections.MutableMapping):
         names = set(self.iterkeys())
         names.update(self._orig)
         for name in names:
-            new = self.raw.get(name)
-            old = self._orig.get(name)
+            new = self.raw.get(name, [])
+            old = self._orig.get(name, [])
             if old and not new:
                 modlist.append((ldap.MOD_DELETE, name, None))
                 continue
-            if not old:
+            if not old and new:
                 modlist.append((ldap.MOD_REPLACE, name, new))
                 continue
 
-- 
1.8.5.3

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to