From 7c9fe57ad82747a32721ca0a08c5569282f3e0c4 Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Fri, 19 Oct 2012 11:43:47 +0200 Subject: change responder contexts hierarchy https://fedorahosted.org/sssd/ticket/1575 The hierarchy is now: main_ctx -> responder_ctx -> specific_ctx where specific_ctx is one of sudo, pam, etc. --- src/responder/nss/nsssrv.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'src/responder/nss/nsssrv.c') diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c index e5334129d..709912c21 100644 --- a/src/responder/nss/nsssrv.c +++ b/src/responder/nss/nsssrv.c @@ -395,6 +395,7 @@ int nss_process_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct confdb_ctx *cdb) { + struct resp_ctx *rctx; struct sss_cmd_table *nss_cmds; struct be_conn *iter; struct nss_ctx *nctx; @@ -403,21 +404,9 @@ int nss_process_init(TALLOC_CTX *mem_ctx, int hret; int fd_limit; - nctx = talloc_zero(mem_ctx, struct nss_ctx); - if (!nctx) { - DEBUG(0, ("fatal error initializing nss_ctx\n")); - return ENOMEM; - } - - ret = sss_ncache_init(nctx, &nctx->ncache); - if (ret != EOK) { - DEBUG(0, ("fatal error initializing negative cache\n")); - goto fail; - } - nss_cmds = get_nss_cmds(); - ret = sss_process_init(nctx, ev, cdb, + ret = sss_process_init(mem_ctx, ev, cdb, nss_cmds, SSS_NSS_SOCKET_NAME, NULL, CONFDB_NSS_CONF_ENTRY, @@ -425,10 +414,26 @@ int nss_process_init(TALLOC_CTX *mem_ctx, NSS_SBUS_SERVICE_VERSION, &monitor_nss_interface, "NSS", &nss_dp_interface, - &nctx->rctx); + &rctx); if (ret != EOK) { + DEBUG(SSSDBG_FATAL_FAILURE, ("sss_process_init() failed\n")); + return ret; + } + + nctx = talloc_zero(rctx, struct nss_ctx); + if (!nctx) { + DEBUG(0, ("fatal error initializing nss_ctx\n")); + ret = ENOMEM; + goto fail; + } + + ret = sss_ncache_init(rctx, &nctx->ncache); + if (ret != EOK) { + DEBUG(0, ("fatal error initializing negative cache\n")); goto fail; } + + nctx->rctx = rctx; nctx->rctx->pvt_ctx = nctx; ret = nss_get_config(nctx, cdb); @@ -513,7 +518,7 @@ int nss_process_init(TALLOC_CTX *mem_ctx, return EOK; fail: - talloc_free(nctx); + talloc_free(rctx); return ret; } -- cgit