URL: https://github.com/freeipa/freeipa/pull/761
Author: felipevolpone
 Title: #761: Fixing adding authenticator indicators to host
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/761/head:pr761
git checkout pr761
From 3cacc719d86b793fe4c88b5bce8707b234b04444 Mon Sep 17 00:00:00 2001
From: Felipe Volpone <felipevolp...@gmail.com>
Date: Tue, 9 May 2017 10:10:36 -0300
Subject: [PATCH 1/2] Fixing adding authenticator indicators to host

The check for krbprincipalaux in the entries is now made
case-insensitively.

https://pagure.io/freeipa/issue/6911
---
 ipaserver/plugins/host.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/ipaserver/plugins/host.py b/ipaserver/plugins/host.py
index dcadd54..d9b8331 100644
--- a/ipaserver/plugins/host.py
+++ b/ipaserver/plugins/host.py
@@ -884,7 +884,8 @@ def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
                 msg = 'Principal name already set, it is unchangeable.'
                 raise errors.ACIError(info=msg)
             obj_classes = entry_attrs_old['objectclass']
-            if 'krbprincipalaux' not in obj_classes:
+            if 'krbprincipalaux' not in (item.lower() for item in
+                                         obj_classes):
                 obj_classes.append('krbprincipalaux')
                 entry_attrs['objectclass'] = obj_classes
 
@@ -920,7 +921,7 @@ def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
             else:
                 _entry_attrs = ldap.get_entry(dn, ['objectclass'])
                 obj_classes = _entry_attrs['objectclass']
-            if 'ieee802device' not in obj_classes:
+            if 'ieee802device' not in (item.lower() for item in obj_classes):
                 obj_classes.append('ieee802device')
                 entry_attrs['objectclass'] = obj_classes
 
@@ -940,7 +941,7 @@ def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
             else:
                 _entry_attrs = ldap.get_entry(dn, ['objectclass'])
                 obj_classes = entry_attrs['objectclass'] = _entry_attrs['objectclass']
-            if 'ipasshhost' not in obj_classes:
+            if 'ipasshhost' not in (item.lower() for item in obj_classes):
                 obj_classes.append('ipasshhost')
 
         update_krbticketflags(ldap, entry_attrs, attrs_list, options, True)
@@ -949,14 +950,16 @@ def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
             if 'objectclass' not in entry_attrs:
                 entry_attrs_old = ldap.get_entry(dn, ['objectclass'])
                 entry_attrs['objectclass'] = entry_attrs_old['objectclass']
-            if 'krbticketpolicyaux' not in entry_attrs['objectclass']:
+            if 'krbticketpolicyaux' not in (item.lower() for item in
+                                            obj_classes):
                 entry_attrs['objectclass'].append('krbticketpolicyaux')
 
         if 'krbprincipalauthind' in entry_attrs:
             if 'objectclass' not in entry_attrs:
                 entry_attrs_old = ldap.get_entry(dn, ['objectclass'])
                 entry_attrs['objectclass'] = entry_attrs_old['objectclass']
-            if 'krbprincipalaux' not in entry_attrs['objectclass']:
+            if 'krbprincipalaux' not in (item.lower() for item in
+                                         obj_classes):
                 entry_attrs['objectclass'].append('krbprincipalaux')
 
         add_sshpubkey_to_attrs_pre(self.context, attrs_list)

From ff0581816d100923ca97493d0c4a76acda5cbfce Mon Sep 17 00:00:00 2001
From: Felipe Volpone <felipevolp...@gmail.com>
Date: Wed, 10 May 2017 10:07:21 -0300
Subject: [PATCH 2/2] Fixing adding authenticator indicators to host

---
 ipaserver/plugins/host.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipaserver/plugins/host.py b/ipaserver/plugins/host.py
index d9b8331..1e1f9d8 100644
--- a/ipaserver/plugins/host.py
+++ b/ipaserver/plugins/host.py
@@ -951,7 +951,7 @@ def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
                 entry_attrs_old = ldap.get_entry(dn, ['objectclass'])
                 entry_attrs['objectclass'] = entry_attrs_old['objectclass']
             if 'krbticketpolicyaux' not in (item.lower() for item in
-                                            obj_classes):
+                                            entry_attrs['objectclass']):
                 entry_attrs['objectclass'].append('krbticketpolicyaux')
 
         if 'krbprincipalauthind' in entry_attrs:
@@ -959,7 +959,7 @@ def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
                 entry_attrs_old = ldap.get_entry(dn, ['objectclass'])
                 entry_attrs['objectclass'] = entry_attrs_old['objectclass']
             if 'krbprincipalaux' not in (item.lower() for item in
-                                         obj_classes):
+                                         entry_attrs['objectclass']):
                 entry_attrs['objectclass'].append('krbprincipalaux')
 
         add_sshpubkey_to_attrs_pre(self.context, attrs_list)
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to