9991ea
From 51f46b7acd00b324e66e5fffd8646a48dc70aa2d Mon Sep 17 00:00:00 2001
9991ea
From: Alexander Bokovoy <abokovoy@redhat.com>
9991ea
Date: Thu, 5 Dec 2013 13:47:37 +0200
9991ea
Subject: [PATCH 13/14] trust: fix get_dn() to distinguish creating and
9991ea
 re-adding trusts
9991ea
9991ea
Latest support for subdomains introduced regression that masked
9991ea
difference between newly added trust and re-added one.
9991ea
9991ea
Additionally, in case no new subdomains were found, the code was
9991ea
returning None instead of an empty list which later could confuse
9991ea
trustdomain-find command.
9991ea
9991ea
https://fedorahosted.org/freeipa/ticket/4067
9991ea
---
9991ea
 ipalib/plugins/trust.py | 4 ++--
9991ea
 1 file changed, 2 insertions(+), 2 deletions(-)
9991ea
9991ea
diff --git a/ipalib/plugins/trust.py b/ipalib/plugins/trust.py
9991ea
index 3b1b2fc67ce333751556a5c3a59a7f89efc608f9..76d609fd4de33edd96715deaaf7842c1de3ddaf4 100644
9991ea
--- a/ipalib/plugins/trust.py
9991ea
+++ b/ipalib/plugins/trust.py
9991ea
@@ -262,7 +262,7 @@ def get_dn(self, *keys, **kwargs):
9991ea
                 result = ldap.get_entries(DN(self.container_dn, self.env.basedn),
9991ea
                                           ldap.SCOPE_SUBTREE, filter, [''])
9991ea
             except errors.NotFound:
9991ea
-                trust_type = u'ad'
9991ea
+                return None
9991ea
             else:
9991ea
                 if len(result) > 1:
9991ea
                     raise errors.OnlyOneValueAllowed(attr='trust domain')
9991ea
@@ -1244,7 +1244,7 @@ def fetch_domains_from_trust(self, trustinstance, trust_entry, **options):
9991ea
                                              trust_name, creds=creds)
9991ea
     result = []
9991ea
     if not domains:
9991ea
-        return None
9991ea
+        return result
9991ea
 
9991ea
     for dom in domains:
9991ea
         dom['trust_type'] = u'ad'
9991ea
-- 
9991ea
1.8.4.2
9991ea