diff options
author | Simo Sorce <idra@samba.org> | 2008-12-08 19:07:56 -0500 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2008-12-08 19:25:21 -0500 |
commit | 8f86577722f9e880c82e7a98fcb14ee06acb7170 (patch) | |
tree | 2a4ed81a4c55c13cf93812fe7a577f081f4613b4 /server/monitor.c | |
parent | 6092cf59d7f5d1c0d915c65bde20fdc98f80c950 (diff) | |
download | sssd-8f86577722f9e880c82e7a98fcb14ee06acb7170.tar.gz sssd-8f86577722f9e880c82e7a98fcb14ee06acb7170.tar.bz2 sssd-8f86577722f9e880c82e7a98fcb14ee06acb7170.zip |
Change data provider into a hub, where backends (ldap, nis, ipa providers)
and frontends (pam, nss, ... modules) can connect to.
Diffstat (limited to 'server/monitor.c')
-rw-r--r-- | server/monitor.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/server/monitor.c b/server/monitor.c index fab88ff9..0075aac7 100644 --- a/server/monitor.c +++ b/server/monitor.c @@ -304,6 +304,7 @@ int monitor_process_init(TALLOC_CTX *mem_ctx, { struct mt_ctx *ctx; struct mt_svc *svc; + char **doms; char *path; int ret, i; @@ -327,6 +328,7 @@ int monitor_process_init(TALLOC_CTX *mem_ctx, return ret; } + /* start all services */ for (i = 0; ctx->services[i]; i++) { svc = talloc_zero(ctx, struct mt_svc); @@ -363,6 +365,58 @@ int monitor_process_init(TALLOC_CTX *mem_ctx, set_tasks_checker(svc); } + /* now start the data providers */ + ret = confdb_get_domains(cdb, ctx, &doms); + if (ret != EOK) { + DEBUG(2, ("No domains configured. LOCAL should always exist!\n")); + return ret; + } + + for (i = 0; doms[i]; i++) { + svc = talloc_zero(ctx, struct mt_svc); + if (!svc) { + talloc_free(ctx); + return ENOMEM; + } + svc->name = talloc_strdup(svc, doms[i]); + svc->mt_ctx = ctx; + + path = talloc_asprintf(svc, "config/domains/%s", svc->name); + if (!path) { + talloc_free(ctx); + return ENOMEM; + } + ret = confdb_get_string(cdb, svc, path, + "command", NULL, &svc->command); + if (ret != EOK) { + DEBUG(0, ("Failed to find provider [%s] configuration\n", + svc->name)); + talloc_free(svc); + continue; + } + + /* if no command is present to not run the domain */ + if (svc->command == NULL) { + /* the LOCAL domain does not need a backend at the moment */ + if (strcasecmp(svc->name, "LOCAL") != 0) { + DEBUG(0, ("Missing command to run provider [%s]\n")); + } + talloc_free(svc); + continue; + } + + ret = start_service(svc->name, svc->command, &svc->pid); + if (ret != EOK) { + DEBUG(0,("Failed to start provider '%s'\n", svc->name)); + talloc_free(svc); + continue; + } + + DLIST_ADD(ctx->svc_list, svc); + + set_tasks_checker(svc); + } + return EOK; } |