diff options
author | Simo Sorce <ssorce@redhat.com> | 2009-04-07 19:25:48 -0400 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-04-08 10:55:03 -0400 |
commit | 6b5d45693f01eec55128eb3508266cda73071d93 (patch) | |
tree | c51ca00f2fb243e5eaf06128e8092583fba1bd8c /server/monitor | |
parent | e8a7526b06acf4af322fdab593c8bafbd9f4a103 (diff) | |
download | sssd-6b5d45693f01eec55128eb3508266cda73071d93.tar.gz sssd-6b5d45693f01eec55128eb3508266cda73071d93.tar.bz2 sssd-6b5d45693f01eec55128eb3508266cda73071d93.zip |
Change the way we retrieve domains
To be able to correctly filter out duplicate names when multiple non-fully
qualified domains are in use we need to be able to specify the domains order.
This is now accomplished by the configuration paramets 'domains' in the
config/domains entry. 'domains' is a comma separated list of domain names.
This paramter allows also to have disbaled domains in the configuration without
requiring to completely delete them.
The domains list is now kept in a linked list of sss_domain_info objects.
The first domain is also the "default" domain.
Diffstat (limited to 'server/monitor')
-rw-r--r-- | server/monitor/monitor.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c index 9320ed82..7fef0822 100644 --- a/server/monitor/monitor.c +++ b/server/monitor/monitor.c @@ -71,7 +71,7 @@ struct mt_svc { struct mt_ctx { struct tevent_context *ev; struct confdb_ctx *cdb; - struct btreemap *dom_map; + struct sss_domain_info *domains; char **services; struct mt_svc *svc_list; struct sbus_srv_ctx *sbus_srv; @@ -380,8 +380,7 @@ int monitor_process_init(TALLOC_CTX *mem_ctx, struct mt_ctx *ctx; struct mt_svc *svc; struct sysdb_ctx *sysdb; - const char **doms; - int dom_count; + struct sss_domain_info *dom; char *path; int ret, i; @@ -485,14 +484,14 @@ int monitor_process_init(TALLOC_CTX *mem_ctx, } /* now start the data providers */ - ret = confdb_get_domains_list(cdb, ctx, - &(ctx->dom_map), &doms, &dom_count); + ret = confdb_get_domains(cdb, ctx, &ctx->domains); if (ret != EOK) { DEBUG(2, ("No domains configured. LOCAL should always exist!\n")); return ret; } - for (i = 0; i < dom_count; i++) { + for (dom = ctx->domains; dom; dom = dom->next) { + svc = talloc_zero(ctx, struct mt_svc); if (!svc) { talloc_free(ctx); @@ -500,7 +499,7 @@ int monitor_process_init(TALLOC_CTX *mem_ctx, } svc->mt_ctx = ctx; - svc->name = talloc_strdup(svc, doms[i]); + svc->name = talloc_strdup(svc, dom->name); if (!svc->name) { talloc_free(ctx); return ENOMEM; @@ -512,7 +511,7 @@ int monitor_process_init(TALLOC_CTX *mem_ctx, return ENOMEM; } - path = talloc_asprintf(svc, "config/domains/%s", doms[i]); + path = talloc_asprintf(svc, "config/domains/%s", svc->name); if (!path) { talloc_free(ctx); return ENOMEM; @@ -521,7 +520,7 @@ int monitor_process_init(TALLOC_CTX *mem_ctx, ret = confdb_get_string(cdb, svc, path, "provider", NULL, &svc->provider); if (ret != EOK) { - DEBUG(0, ("Failed to find provider from [%s] configuration\n", doms[i])); + DEBUG(0, ("Failed to find provider from [%s] configuration\n", svc->name)); talloc_free(svc); continue; } @@ -529,7 +528,7 @@ int monitor_process_init(TALLOC_CTX *mem_ctx, ret = confdb_get_string(cdb, svc, path, "command", NULL, &svc->command); if (ret != EOK) { - DEBUG(0, ("Failed to find command from [%s] configuration\n", doms[i])); + DEBUG(0, ("Failed to find command from [%s] configuration\n", svc->name)); talloc_free(svc); continue; } @@ -564,7 +563,7 @@ int monitor_process_init(TALLOC_CTX *mem_ctx, ret = start_service(svc); if (ret != EOK) { - DEBUG(0,("Failed to start provider for '%s'\n", doms[i])); + DEBUG(0,("Failed to start provider for '%s'\n", svc->name)); talloc_free(svc); continue; } |