diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2009-11-30 14:18:58 +0100 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-12-03 10:26:21 -0500 |
commit | f1dbd630abdc2022f3bfe7e08331d39645119103 (patch) | |
tree | a9f849eef5d180395a6a92f681ff074fb88c69b5 /server/monitor | |
parent | b2611932cf2e95d5b0f8c36cbdc02feee64b6df8 (diff) | |
download | sssd-f1dbd630abdc2022f3bfe7e08331d39645119103.tar.gz sssd-f1dbd630abdc2022f3bfe7e08331d39645119103.tar.bz2 sssd-f1dbd630abdc2022f3bfe7e08331d39645119103.zip |
Check the services started against a list of known services
Fixes: #241
Diffstat (limited to 'server/monitor')
-rw-r--r-- | server/monitor/monitor.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c index 65b9475c..d47b3a80 100644 --- a/server/monitor/monitor.c +++ b/server/monitor/monitor.c @@ -913,10 +913,33 @@ static int check_local_domain_unique(struct sss_domain_info *domains) return EOK; } +static char *check_services(char **services) +{ + const char *known_services[] = { "nss", "pam", NULL }; + int i; + int ii; + + /* Check if services we are about to start are in the list if known */ + for (i = 0; services[i]; i++) { + for (ii=0; known_services[ii]; ii++) { + if (strcasecmp(services[i], known_services[ii]) == 0) { + break; + } + } + + if (known_services[ii] == NULL) { + return services[i]; + } + } + + return NULL; +} + int get_monitor_config(struct mt_ctx *ctx) { int ret; int timeout_seconds; + char *badsrv = NULL; ret = confdb_get_int(ctx->cdb, ctx, CONFDB_MONITOR_CONF_ENTRY, @@ -941,6 +964,12 @@ int get_monitor_config(struct mt_ctx *ctx) return EINVAL; } + badsrv = check_services(ctx->services); + if (badsrv != NULL) { + DEBUG(0, ("Invalid service %s\n", badsrv)); + return EINVAL; + } + ctx->domain_ctx = talloc_new(ctx); if(!ctx->domain_ctx) { return ENOMEM; |