From 24480f7fa3bf3f40bd9fb7c865f9e3b329bf3ed8 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Fri, 27 Feb 2009 13:35:33 -0500 Subject: Refactor creation of domain_map into confdb The NSS provider, the Data Provider backends and the InfoPipe all need access to the domain map provided by the confdb. Instead of reimplimenting it in multiple places, it is now provided in a pair of helper functions from the confdb. confdb_get_domains() returns a domain map by reference. Always returns the most up-to-date set of domains from the confdb. confdb_get_domains_list() returns an array of strings of all the domain names. Always returns the most up-to-date set of domains from the confdb. This patch also modifies the btreemap_get_keys() function to better handle memory and report allocation failures. --- server/monitor/monitor.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'server/monitor') diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c index ff88b293..a07178f8 100644 --- a/server/monitor/monitor.c +++ b/server/monitor/monitor.c @@ -365,6 +365,7 @@ int monitor_process_init(TALLOC_CTX *mem_ctx, struct mt_ctx *ctx; struct mt_svc *svc; char **doms; + int dom_count; char *path; int ret, i; @@ -434,13 +435,13 @@ int monitor_process_init(TALLOC_CTX *mem_ctx, } /* now start the data providers */ - ret = confdb_get_domains(cdb, ctx, &doms); + ret = confdb_get_domains_list(cdb, ctx, (const char ***)&doms, &dom_count); if (ret != EOK) { DEBUG(2, ("No domains configured. LOCAL should always exist!\n")); return ret; } - for (i = 0; doms[i]; i++) { + for (i = 0; i < dom_count; i++) { svc = talloc_zero(ctx, struct mt_svc); if (!svc) { talloc_free(ctx); -- cgit