From 0206dbe79502dd06b9c44622ead4635e430e3620 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Fri, 27 Apr 2012 07:15:56 -0400 Subject: Do not crash on empty reverse member options Calling a LDAP{Add,Remove}ReverseMember with an empty reverse_member caused an internal error, because empty values are converted to None, which is then iterated. Use an empty list instead of None (or other false falues, of which we only use the empty list). https://fedorahosted.org/freeipa/ticket/2681 --- ipalib/plugins/baseldap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ipalib/plugins/baseldap.py') diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py index d37a20d1..5a8013ef 100644 --- a/ipalib/plugins/baseldap.py +++ b/ipalib/plugins/baseldap.py @@ -1966,7 +1966,7 @@ class LDAPAddReverseMember(LDAPModReverseMember): entry_start = self.api.Command[self.show_command](keys[-1])['result'] completed = 0 failed = {'member': {self.reverse_attr: []}} - for attr in options.get(self.reverse_attr, []): + for attr in options.get(self.reverse_attr) or []: try: options = {'%s' % self.member_attr: keys[-1]} try: @@ -2073,7 +2073,7 @@ class LDAPRemoveReverseMember(LDAPModReverseMember): entry_start = self.api.Command[self.show_command](keys[-1])['result'] completed = 0 failed = {'member': {self.reverse_attr: []}} - for attr in options.get(self.reverse_attr, []): + for attr in options.get(self.reverse_attr) or []: try: options = {'%s' % self.member_attr: keys[-1]} try: -- cgit