summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-14 17:04:00 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-02-10 22:08:47 +0100
commit0232747f04b650796db56fd7b487aee8a96fab03 (patch)
tree0c0329a59cbb66b1e4ea4983cd034dc9015245dc /src/tools
parent95e94691178297f2b8225a83d43ae388cab04b45 (diff)
downloadsssd-0232747f04b650796db56fd7b487aee8a96fab03.tar.gz
sssd-0232747f04b650796db56fd7b487aee8a96fab03.tar.xz
sssd-0232747f04b650796db56fd7b487aee8a96fab03.zip
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()
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/sss_cache.c2
-rw-r--r--src/tools/sss_debuglevel.c9
2 files changed, 8 insertions, 3 deletions
diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c
index 2fb75ad60..db6c792cd 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 e955ec381..ce428bd92 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) {