From c5f66b8c471e472b3c6eecf87c93373ecf8d0890 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Tue, 4 Jan 2011 10:38:40 +0100 Subject: Remove unused enumeration cache timeout checks The existence of the getent_ctx is used to track the enumeration cache timeout. --- src/responder/nss/nsssrv.h | 2 -- src/responder/nss/nsssrv_cmd.c | 32 ++------------------------------ src/responder/nss/nsssrv_private.h | 1 - 3 files changed, 2 insertions(+), 33 deletions(-) diff --git a/src/responder/nss/nsssrv.h b/src/responder/nss/nsssrv.h index 0b7265b7c..062d937fc 100644 --- a/src/responder/nss/nsssrv.h +++ b/src/responder/nss/nsssrv.h @@ -49,8 +49,6 @@ struct nss_ctx { int cache_refresh_percent; int enum_cache_timeout; - time_t last_user_enum; - time_t last_group_enum; struct getent_ctx *pctx; struct getent_ctx *gctx; diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c index c9c7920f2..2153d649c 100644 --- a/src/responder/nss/nsssrv_cmd.c +++ b/src/responder/nss/nsssrv_cmd.c @@ -981,8 +981,6 @@ struct tevent_req *nss_cmd_setpwent_send(TALLOC_CTX *mem_ctx, struct setent_ctx *state; struct sss_domain_info *dom; struct setent_step_ctx *step_ctx; - bool enum_cached = false; - time_t now = time(NULL); DEBUG(4, ("Received setpwent request\n")); nctx = talloc_get_type(client->rctx->pvt_ctx, struct nss_ctx); @@ -1000,13 +998,6 @@ struct tevent_req *nss_cmd_setpwent_send(TALLOC_CTX *mem_ctx, state->nctx = nctx; state->client = client; - /* do not query backends if we have a recent enumeration */ - if (nctx->enum_cache_timeout) { - if (nctx->last_user_enum + nctx->enum_cache_timeout > now) { - enum_cached = true; - } - } - state->dctx = talloc_zero(state, struct nss_dom_ctx); if (!state->dctx) { ret = ENOMEM; @@ -1080,7 +1071,6 @@ struct tevent_req *nss_cmd_setpwent_send(TALLOC_CTX *mem_ctx, step_ctx->nctx = state->nctx; step_ctx->getent_ctx = state->getent_ctx; step_ctx->rctx = client->rctx; - step_ctx->enum_cached = enum_cached; step_ctx->returned_to_mainloop = false; ret = nss_cmd_setpwent_step(step_ctx); @@ -1134,11 +1124,7 @@ static errno_t nss_cmd_setpwent_step(struct setent_step_ctx *step_ctx) if (dom != dctx->domain) { /* make sure we reset the check_provider flag when we check * a new domain */ - if (step_ctx->enum_cached) { - dctx->check_provider = false; - } else { - dctx->check_provider = NEED_CHECK_PROVIDER(dom->provider); - } + dctx->check_provider = NEED_CHECK_PROVIDER(dom->provider); } /* make sure to update the dctx if we changed domain */ @@ -2250,8 +2236,6 @@ struct tevent_req *nss_cmd_setgrent_send(TALLOC_CTX *mem_ctx, struct setent_ctx *state; struct sss_domain_info *dom; struct setent_step_ctx *step_ctx; - bool enum_cached = false; - time_t now = time(NULL); DEBUG(4, ("Received setgrent request\n")); nctx = talloc_get_type(client->rctx->pvt_ctx, struct nss_ctx); @@ -2269,13 +2253,6 @@ struct tevent_req *nss_cmd_setgrent_send(TALLOC_CTX *mem_ctx, state->nctx = nctx; state->client = client; - /* do not query backends if we have a recent enumeration */ - if (nctx->enum_cache_timeout) { - if (nctx->last_user_enum + nctx->enum_cache_timeout > now) { - enum_cached = true; - } - } - state->dctx = talloc_zero(state, struct nss_dom_ctx); if (!state->dctx) { ret = ENOMEM; @@ -2349,7 +2326,6 @@ struct tevent_req *nss_cmd_setgrent_send(TALLOC_CTX *mem_ctx, step_ctx->nctx = state->nctx; step_ctx->getent_ctx = state->getent_ctx; step_ctx->rctx = client->rctx; - step_ctx->enum_cached = enum_cached; step_ctx->returned_to_mainloop = false; ret = nss_cmd_setgrent_step(step_ctx); @@ -2403,11 +2379,7 @@ static errno_t nss_cmd_setgrent_step(struct setent_step_ctx *step_ctx) if (dom != dctx->domain) { /* make sure we reset the check_provider flag when we check * a new domain */ - if (step_ctx->enum_cached) { - dctx->check_provider = false; - } else { - dctx->check_provider = NEED_CHECK_PROVIDER(dom->provider); - } + dctx->check_provider = NEED_CHECK_PROVIDER(dom->provider); } /* make sure to update the dctx if we changed domain */ diff --git a/src/responder/nss/nsssrv_private.h b/src/responder/nss/nsssrv_private.h index 3eaaa9b7d..52c4ace3a 100644 --- a/src/responder/nss/nsssrv_private.h +++ b/src/responder/nss/nsssrv_private.h @@ -84,7 +84,6 @@ struct setent_step_ctx { struct nss_dom_ctx *dctx; struct getent_ctx *getent_ctx; struct resp_ctx *rctx; - bool enum_cached; bool check_next; bool returned_to_mainloop; -- cgit