diff options
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; +} + |