diff options
author | Petr Viktorin <pviktori@redhat.com> | 2012-04-27 07:15:56 -0400 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-05-07 17:21:58 +0200 |
commit | 0206dbe79502dd06b9c44622ead4635e430e3620 (patch) | |
tree | ce241048b05e5d385c51c2b0218adf9aa7253fe7 /ipalib | |
parent | c45174d68009076781431ad13a51bd454f6e3ce8 (diff) | |
download | freeipa-0206dbe79502dd06b9c44622ead4635e430e3620.tar.gz freeipa-0206dbe79502dd06b9c44622ead4635e430e3620.tar.xz freeipa-0206dbe79502dd06b9c44622ead4635e430e3620.zip |
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
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/plugins/baseldap.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py index d37a20d1f..5a8013efc 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: |