Fix modlist generation code not to generate empty replace mods.

https://fedorahosted.org/freeipa/ticket/4138
Reviewed-By: Petr Viktorin <pviktori@redhat.com>
This commit is contained in:
Jan Cholasta 2014-02-04 11:39:35 +01:00 committed by Petr Viktorin
parent e99fa380af
commit c0c38ed314

View File

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