From 553b185f1c765855fe5f5ce9b29533261f80fcba Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 27 May 2009 15:15:46 +0200 Subject: Make Data Provider a mandatory service --- server/monitor/monitor.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c index 26c600705..906d15798 100644 --- a/server/monitor/monitor.c +++ b/server/monitor/monitor.c @@ -581,6 +581,33 @@ static int check_domain_ranges(struct sss_domain_info *domains) return EOK; } +static int append_data_provider(struct mt_ctx *ctx) +{ + int i; + char **new_services; + + for (i = 0; ctx->services[i]; i++) { + if (strcasecmp(ctx->services[i], "dp") == 0) { + return EOK; + } + } + + new_services = talloc_realloc(ctx, ctx->services, char *, i+2); + if (new_services == NULL) { + return ENOMEM; + } + ctx->services = new_services; + + ctx->services[i] = talloc_asprintf(ctx, "dp"); + if (ctx->services[i] == NULL) { + return ENOMEM; + } + ctx->services[i+1] = NULL; + DEBUG(4, ("Added mandatory service Data Provider\n")); + + return EOK; +} + int get_monitor_config(struct mt_ctx *ctx) { int ret; @@ -598,6 +625,11 @@ int get_monitor_config(struct mt_ctx *ctx) DEBUG(0, ("No services configured!\n")); return EINVAL; } + ret = append_data_provider(ctx); + if (ret != EOK) { + DEBUG(0, ("Could not add Data Provider to the list of services!\n")); + return ret; + } ret = confdb_get_domains(ctx->cdb, ctx, &ctx->domains); if (ret != EOK) { -- cgit