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:36 -0500 |
commit | 5730c6aac0263416f46e32f1536eb8124c4dd1a3 (patch) | |
tree | 8e663af8defae69dcb691d0c7233fe1fcc4044a1 /server | |
parent | 75d30d6bb50f6d60b3401c2f7dd120524e83650f (diff) | |
download | sssd-5730c6aac0263416f46e32f1536eb8124c4dd1a3.tar.gz sssd-5730c6aac0263416f46e32f1536eb8124c4dd1a3.tar.xz sssd-5730c6aac0263416f46e32f1536eb8124c4dd1a3.zip |
Check the services started against a list of known services
Fixes: #241
Diffstat (limited to 'server')
-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 65b9475c8..d47b3a80a 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; |