summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-12-09 08:07:33 -0500
committerStephen Gallagher <sgallagh@redhat.com>2009-12-09 10:05:11 -0500
commit052d1ae529b59360d4c3faa9154dd3c367326be1 (patch)
treeecce3cd8e518704692fdd670755216cbf0c5a645
parentd9d96ee0b39de247e83beb92ec24f6adc02a4698 (diff)
downloadsssd-052d1ae529b59360d4c3faa9154dd3c367326be1.tar.gz
sssd-052d1ae529b59360d4c3faa9154dd3c367326be1.tar.xz
sssd-052d1ae529b59360d4c3faa9154dd3c367326be1.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.
-rw-r--r--server/config/SSSDConfig.py20
1 files 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.