summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-14 21:45:55 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-02-10 22:08:47 +0100
commit1f800ebb0f190854b8296146174f3d696a426333 (patch)
tree3b8ac0dcd332177f48ba4339442f6d8eae925534 /src/util
parent0232747f04b650796db56fd7b487aee8a96fab03 (diff)
downloadsssd-1f800ebb0f190854b8296146174f3d696a426333.tar.gz
sssd-1f800ebb0f190854b8296146174f3d696a426333.tar.bz2
sssd-1f800ebb0f190854b8296146174f3d696a426333.zip
Add ability to disable domains
Diffstat (limited to 'src/util')
-rw-r--r--src/util/domain_info_utils.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c
index 8cba7dca..59d5c534 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;
}