From 7baca1d2475b7169392cd206cbb08d84a32f64ae Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Tue, 4 Jan 2011 10:38:40 +0100 Subject: [PATCH 3/3] 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 | 20 -------------------- src/responder/nss/nsssrv_private.h | 1 - 3 files changed, 0 insertions(+), 23 deletions(-) diff --git a/src/responder/nss/nsssrv.h b/src/responder/nss/nsssrv.h index 0b7265b..062d937 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 ea89a9d..caa74dc 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; @@ -1079,7 +1070,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->cmd = SSS_NSS_SETPWENT; ret = nss_cmd_setpwent_step(step_ctx); @@ -2247,8 +2237,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); @@ -2266,13 +2254,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; @@ -2345,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->cmd = SSS_NSS_SETGRENT; ret = nss_cmd_setgrent_step(step_ctx); diff --git a/src/responder/nss/nsssrv_private.h b/src/responder/nss/nsssrv_private.h index be65877..b93a1c4 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; enum sss_cli_command cmd; -- 1.7.3.3