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/confdb/confdb.h | 2 ++ src/util/domain_info_utils.c | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h index 45412538a..71c30367f 100644 --- a/src/confdb/confdb.h +++ b/src/confdb/confdb.h @@ -238,6 +238,8 @@ struct sss_domain_info { struct timeval subdomains_last_checked; struct sss_domain_info *next; + + bool disabled; }; /** 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