From 1f800ebb0f190854b8296146174f3d696a426333 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 14 Jan 2013 21:45:55 -0500 Subject: Add ability to disable domains --- src/util/domain_info_utils.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/util') diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c index 8cba7dca7..59d5c534b 100644 --- a/src/util/domain_info_utils.c +++ b/src/util/domain_info_utils.c @@ -28,15 +28,19 @@ struct sss_domain_info *get_next_domain(struct sss_domain_info *domain, struct sss_domain_info *dom; dom = domain; - if (descend && dom->subdomain_count > 0) { - dom = dom->subdomains[0]; - } else if (dom->next) { - dom = dom->next; - } else if (descend && dom->parent) { - dom = dom->parent->next; - } else { - dom = NULL; + while (dom) { + if (descend && dom->subdomain_count > 0) { + dom = dom->subdomains[0]; + } else if (dom->next) { + dom = dom->next; + } else if (descend && dom->parent) { + dom = dom->parent->next; + } else { + return NULL; + } + if (!dom->disabled) break; } + return dom; } -- cgit