From e6cc41094b2bc526e9f8e87229e8f83a74cfc263 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Fri, 3 Jun 2022 18:28:38 -0400 Subject: [PATCH] graceperiod: ignore case when checking for missing objectclass Don't assume that all objectclasses are lower-case. Some are camel-cased. Fixes: https://pagure.io/freeipa/issue/1539 Signed-off-by: Rob Crittenden Reviewed-By: Alexander Bokovoy Reviewed-By: Florence Blanc-Renaud Reviewed-By: Florence Blanc-Renaud Reviewed-By: Alexander Bokovoy --- ipaserver/plugins/pwpolicy.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ipaserver/plugins/pwpolicy.py b/ipaserver/plugins/pwpolicy.py index 3893dc058..fd2bf06aa 100644 --- a/ipaserver/plugins/pwpolicy.py +++ b/ipaserver/plugins/pwpolicy.py @@ -587,7 +587,9 @@ class pwpolicy_mod(LDAPUpdate): def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options): assert isinstance(dn, DN) old_entry_attrs = ldap.get_entry(dn, ['objectclass']) - if 'ipapwdpolicy' not in old_entry_attrs['objectclass']: + if not self.obj.has_objectclass( + old_entry_attrs['objectclass'], 'ipapwdpolicy' + ): old_entry_attrs['objectclass'].append('ipapwdpolicy') entry_attrs['objectclass'] = old_entry_attrs['objectclass'] self.obj.convert_time_on_input(entry_attrs)