From 6092cf59d7f5d1c0d915c65bde20fdc98f80c950 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 25 Nov 2008 16:45:11 -0500 Subject: Make a binary out of each major sssd component instead of using the same binary to fork off all services. --- server/nss/nsssrv.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'server/nss/nsssrv.c') diff --git a/server/nss/nsssrv.c b/server/nss/nsssrv.c index ab1ef441..ccbd7ba8 100644 --- a/server/nss/nsssrv.c +++ b/server/nss/nsssrv.c @@ -29,6 +29,7 @@ #include #include #include +#include "popt.h" #include "ldb.h" #include "util/util.h" #include "nss/nsssrv.h" @@ -418,3 +419,45 @@ int nss_process_init(TALLOC_CTX *mem_ctx, return EOK; } + +int main(int argc, const char *argv[]) +{ + int opt; + poptContext pc; + struct main_context *main_ctx; + int ret; + + struct poptOption long_options[] = { + POPT_AUTOHELP + SSSD_MAIN_OPTS + { NULL } + }; + + pc = poptGetContext(argv[0], argc, argv, long_options, 0); + while((opt = poptGetNextOpt(pc)) != -1) { + switch(opt) { + default: + fprintf(stderr, "\nInvalid option %s: %s\n\n", + poptBadOption(pc, 0), poptStrerror(opt)); + poptPrintUsage(pc, stderr, 0); + return 1; + } + } + + poptFreeContext(pc); + + /* set up things like debug , signals, daemonization, etc... */ + ret = server_setup("sssd[nss]", 0, &main_ctx); + if (ret != EOK) return 2; + + ret = nss_process_init(main_ctx, + main_ctx->event_ctx, + main_ctx->confdb_ctx); + if (ret != EOK) return 3; + + /* loop on main */ + server_loop(main_ctx); + + return 0; +} + -- cgit