From 0232747f04b650796db56fd7b487aee8a96fab03 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 14 Jan 2013 17:04:00 -0500 Subject: Add function get_next_domain() Use this function instead of explicitly calling domain->next This function allows to get the next primary domain or to descend into the subdomains and replaces also get_next_dom_or_subdom() --- src/tools/sss_cache.c | 2 +- src/tools/sss_debuglevel.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src/tools') diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c index 2fb75ad6..db6c792c 100644 --- a/src/tools/sss_cache.c +++ b/src/tools/sss_cache.c @@ -103,7 +103,7 @@ int main(int argc, const char *argv[]) goto done; } - for (dinfo = tctx->domains; dinfo; dinfo = dinfo->next) { + for (dinfo = tctx->domains; dinfo; dinfo = get_next_domain(dinfo, false)) { sysdb = dinfo->sysdb; /* Update filters for each domain */ diff --git a/src/tools/sss_debuglevel.c b/src/tools/sss_debuglevel.c index e955ec38..ce428bd9 100644 --- a/src/tools/sss_debuglevel.c +++ b/src/tools/sss_debuglevel.c @@ -253,8 +253,11 @@ errno_t get_confdb_sections(TALLOC_CTX *ctx, struct confdb_ctx *confdb, if (ret != EOK) DEBUG(SSSDBG_CRIT_FAILURE, ("Unable to get domain list\n")); - for (domain = domain_list; domain != NULL; domain = domain->next) + for (domain = domain_list; + domain; + domain = get_next_domain(domain, false)) { domain_count++; + } /* allocate output space */ sections = talloc_array(ctx, char*, @@ -275,7 +278,9 @@ errno_t get_confdb_sections(TALLOC_CTX *ctx, struct confdb_ctx *confdb, } } - for (domain = domain_list; domain != NULL; domain = domain->next, i++) { + for (domain = domain_list; + domain; + domain = get_next_domain(domain, false), i++) { sections[i] = talloc_asprintf(tmp_ctx, CONFDB_DOMAIN_PATH_TMPL, domain->name); if (sections[i] == NULL) { -- cgit