ac7d03
From 43871c023ac22a0ae2c4b5fb264b69c6e8029f49 Mon Sep 17 00:00:00 2001
ac7d03
From: Felipe Volpone <felipevolpone@gmail.com>
ac7d03
Date: Thu, 11 May 2017 10:26:03 -0300
ac7d03
Subject: [PATCH] Fixing adding authenticator indicators to host
ac7d03
ac7d03
The check for krbprincipalaux in the entries is now made
ac7d03
case-insensitively.
ac7d03
ac7d03
https://pagure.io/freeipa/issue/6911
ac7d03
ac7d03
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
ac7d03
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
ac7d03
---
ac7d03
 ipaserver/plugins/host.py | 13 ++++++++-----
ac7d03
 1 file changed, 8 insertions(+), 5 deletions(-)
ac7d03
ac7d03
diff --git a/ipaserver/plugins/host.py b/ipaserver/plugins/host.py
ac7d03
index dcadd54a10692f64f0464d964f43c7881875d433..1e1f9d82dfdfcf9e7fef65ce729cd8ee7b76e605 100644
ac7d03
--- a/ipaserver/plugins/host.py
ac7d03
+++ b/ipaserver/plugins/host.py
ac7d03
@@ -884,7 +884,8 @@ class host_mod(LDAPUpdate):
ac7d03
                 msg = 'Principal name already set, it is unchangeable.'
ac7d03
                 raise errors.ACIError(info=msg)
ac7d03
             obj_classes = entry_attrs_old['objectclass']
ac7d03
-            if 'krbprincipalaux' not in obj_classes:
ac7d03
+            if 'krbprincipalaux' not in (item.lower() for item in
ac7d03
+                                         obj_classes):
ac7d03
                 obj_classes.append('krbprincipalaux')
ac7d03
                 entry_attrs['objectclass'] = obj_classes
ac7d03
 
ac7d03
@@ -920,7 +921,7 @@ class host_mod(LDAPUpdate):
ac7d03
             else:
ac7d03
                 _entry_attrs = ldap.get_entry(dn, ['objectclass'])
ac7d03
                 obj_classes = _entry_attrs['objectclass']
ac7d03
-            if 'ieee802device' not in obj_classes:
ac7d03
+            if 'ieee802device' not in (item.lower() for item in obj_classes):
ac7d03
                 obj_classes.append('ieee802device')
ac7d03
                 entry_attrs['objectclass'] = obj_classes
ac7d03
 
ac7d03
@@ -940,7 +941,7 @@ class host_mod(LDAPUpdate):
ac7d03
             else:
ac7d03
                 _entry_attrs = ldap.get_entry(dn, ['objectclass'])
ac7d03
                 obj_classes = entry_attrs['objectclass'] = _entry_attrs['objectclass']
ac7d03
-            if 'ipasshhost' not in obj_classes:
ac7d03
+            if 'ipasshhost' not in (item.lower() for item in obj_classes):
ac7d03
                 obj_classes.append('ipasshhost')
ac7d03
 
ac7d03
         update_krbticketflags(ldap, entry_attrs, attrs_list, options, True)
ac7d03
@@ -949,14 +950,16 @@ class host_mod(LDAPUpdate):
ac7d03
             if 'objectclass' not in entry_attrs:
ac7d03
                 entry_attrs_old = ldap.get_entry(dn, ['objectclass'])
ac7d03
                 entry_attrs['objectclass'] = entry_attrs_old['objectclass']
ac7d03
-            if 'krbticketpolicyaux' not in entry_attrs['objectclass']:
ac7d03
+            if 'krbticketpolicyaux' not in (item.lower() for item in
ac7d03
+                                            entry_attrs['objectclass']):
ac7d03
                 entry_attrs['objectclass'].append('krbticketpolicyaux')
ac7d03
 
ac7d03
         if 'krbprincipalauthind' in entry_attrs:
ac7d03
             if 'objectclass' not in entry_attrs:
ac7d03
                 entry_attrs_old = ldap.get_entry(dn, ['objectclass'])
ac7d03
                 entry_attrs['objectclass'] = entry_attrs_old['objectclass']
ac7d03
-            if 'krbprincipalaux' not in entry_attrs['objectclass']:
ac7d03
+            if 'krbprincipalaux' not in (item.lower() for item in
ac7d03
+                                         entry_attrs['objectclass']):
ac7d03
                 entry_attrs['objectclass'].append('krbprincipalaux')
ac7d03
 
ac7d03
         add_sshpubkey_to_attrs_pre(self.context, attrs_list)
ac7d03
-- 
ac7d03
2.9.3
ac7d03