From 052d1ae529b59360d4c3faa9154dd3c367326be1 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 9 Dec 2009 08:07:33 -0500 Subject: Ensure that list_active_domains returns the real value Previously, we were accidentally filtering out domains that were not configured, so deleted domains might still appear in the active domain list. This patch should ensure that this never happens. --- server/config/SSSDConfig.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/server/config/SSSDConfig.py b/server/config/SSSDConfig.py index 10d2f02a1..045aac31a 100644 --- a/server/config/SSSDConfig.py +++ b/server/config/SSSDConfig.py @@ -1154,12 +1154,22 @@ class SSSDConfig(SSSDChangeConf): if (self.has_option('sssd', 'domains')): active_domains = striplist(self.get('sssd', 'domains').split(',')) + domain_dict = dict.fromkeys(active_domains) + if domain_dict.has_key(''): + del domain_dict[''] + + # Remove any entries in this list that don't + # correspond to an active domain, for integrity + configured_domains = self.list_domains() + for dom in domain_dict.keys(): + if dom not in configured_domains: + del domain_dict[dom] + + active_domains = domain_dict.keys() else: active_domains = [] - domains = [x for x in self.list_domains() - if x in active_domains] - return domains + return active_domains def list_inactive_domains(self): """ @@ -1430,8 +1440,10 @@ class SSSDConfig(SSSDChangeConf): if domain.oldname and domain.oldname != name: # We are renaming this domain # Remove the old section + + self.deactivate_domain(domain.oldname) oldindex = self.delete_option('section', 'domain/%s' % - domain.oldname) + domain.oldname) # Reset the oldname, in case we're not done with # this domain object. -- cgit