diff options
author | Simo Sorce <idra@samba.org> | 2008-11-25 16:45:11 -0500 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2008-11-25 19:49:18 -0500 |
commit | 6092cf59d7f5d1c0d915c65bde20fdc98f80c950 (patch) | |
tree | e3689b6e32d1079e38d00297395be3fbe2291169 /server/nss/nsssrv.c | |
parent | d4b9a588bade582ba2968f270101032a11981e17 (diff) | |
download | sssd-6092cf59d7f5d1c0d915c65bde20fdc98f80c950.tar.gz sssd-6092cf59d7f5d1c0d915c65bde20fdc98f80c950.tar.bz2 sssd-6092cf59d7f5d1c0d915c65bde20fdc98f80c950.zip |
Make a binary out of each major sssd component instead of
using the same binary to fork off all services.
Diffstat (limited to 'server/nss/nsssrv.c')
-rw-r--r-- | server/nss/nsssrv.c | 43 |
1 files changed, 43 insertions, 0 deletions
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 <string.h> #include <sys/time.h> #include <errno.h> +#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; +} + |