Hi,

I had some time and was blocked by these bugs to do my tickets so I
actually fixed these three problems that are assigned to Martin
Babinsky. Hopefully, Martin wouldn't be offended by that. :)

Note that this fix (patch 0211) has potential for a break but also
introduces a correct behavior in my view as we should not really have
non-lower cased keys in LDAP dictionaries in entry_to_dict() for both
normal and --raw modes.

----- 0211

Since commit a8dd7aa337f25abd938a582d0fcba51d3b356410 if IPA command
is called with --raw option, a retrieved LDAP entry's attribute
names aren't normalized to lower case when converting the entry
to a dictionary. This breaks overall assumption that dictionary
keys are in lower case.

Partially fixes 'ipa trust-add --raw' issues.

https://fedorahosted.org/freeipa/ticket/6059

----- 0212

Make sure we display raw values for 'trust-add --raw' case.

https://fedorahosted.org/freeipa/ticket/6059


--
/ Alexander Bokovoy
From 8642a9b96a4c6b4f363790f74c1e63e0b98b3676 Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <aboko...@redhat.com>
Date: Sat, 16 Jul 2016 13:35:25 +0300
Subject: [PATCH 2/3] baseldap: make sure entry_to_dict always creates
 lower-cased keys

Since commit a8dd7aa337f25abd938a582d0fcba51d3b356410 if IPA command
is called with --raw option, a retrieved LDAP entry's attribute
names aren't normalized to lower case when converting the entry
to a dictionary. This breaks overall assumption that dictionary
keys are in lower case.

Partially fixes 'ipa trust-add --raw' issues.

https://fedorahosted.org/freeipa/ticket/6059
---
 ipaserver/plugins/baseldap.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipaserver/plugins/baseldap.py b/ipaserver/plugins/baseldap.py
index 6107e43..726a8b7 100644
--- a/ipaserver/plugins/baseldap.py
+++ b/ipaserver/plugins/baseldap.py
@@ -258,7 +258,7 @@ def entry_to_dict(entry, **options):
                         value[i] = v.decode('utf-8')
                     except UnicodeDecodeError:
                         pass
-            result[attr] = value
+            result[attr.lower()] = value
     else:
         result = dict((k.lower(), v) for (k, v) in entry.items())
     if options.get('all', False):
-- 
2.7.4

From 966edb92aadc5ae754a0e4be510f18dc69160e64 Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <aboko...@redhat.com>
Date: Sat, 16 Jul 2016 13:41:49 +0300
Subject: [PATCH 3/3] trust: don't translate attributes when trust-add is
 called with --raw

Make sure we display raw values for 'trust-add --raw' case.

https://fedorahosted.org/freeipa/ticket/6059
---
 ipaserver/plugins/trust.py | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/ipaserver/plugins/trust.py b/ipaserver/plugins/trust.py
index 8536202..c6394f2 100644
--- a/ipaserver/plugins/trust.py
+++ b/ipaserver/plugins/trust.py
@@ -761,16 +761,17 @@ sides.
                 # add_new_domains_from_trust() on its own.
                 fetch_trusted_domains_over_dbus(self.api, self.log, 
result['value'])
 
-        # Format the output into human-readable values
-        attributes = int(result['result'].get('ipanttrustattributes', [0])[0])
-        result['result']['trusttype'] = [trust_type_string(
-            result['result']['ipanttrusttype'][0], attributes)]
-        result['result']['trustdirection'] = [trust_direction_string(
-            result['result']['ipanttrustdirection'][0])]
-        result['result']['truststatus'] = [trust_status_string(
-            result['verified'])]
-        if attributes:
-            result['result'].pop('ipanttrustattributes', None)
+        if options.get('raw', False):
+            # Format the output into human-readable values
+            attributes = int(result['result'].get('ipanttrustattributes', 
[0])[0])
+            result['result']['trusttype'] = [trust_type_string(
+                result['result'].get('ipanttrusttype', [0])[0], attributes)]
+            result['result']['trustdirection'] = [trust_direction_string(
+                result['result'].get('ipanttrustdirection', [0])[0])]
+            result['result']['truststatus'] = [trust_status_string(
+                result['verified'])]
+            if attributes:
+                result['result'].pop('ipanttrustattributes', None)
 
         del result['verified']
         result['result'].pop('ipanttrustauthoutgoing', None)
-- 
2.7.4

-- 
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