diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2009-12-09 08:07:33 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-12-09 10:05:18 -0500 |
commit | 46e73b48bea5529e731998a823fe42aa13657f45 (patch) | |
tree | d22322b679317bcb48b96719b965263d155be649 /server/config | |
parent | 2de0208d7499603c78d232361030f9a73fa6adda (diff) | |
download | sssd-46e73b48bea5529e731998a823fe42aa13657f45.tar.gz sssd-46e73b48bea5529e731998a823fe42aa13657f45.tar.bz2 sssd-46e73b48bea5529e731998a823fe42aa13657f45.zip |
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.
Diffstat (limited to 'server/config')
-rw-r--r-- | server/config/SSSDConfig.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/server/config/SSSDConfig.py b/server/config/SSSDConfig.py index 10d2f02a..045aac31 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. |