summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2012-05-16 14:32:29 -0400
committerStephen Gallagher <sgallagh@redhat.com>2012-05-16 16:21:10 -0400
commit24b333a01aec29cd0fbe3042f362d5bbeec6b99b (patch)
tree54f2832f6fa2a605f0f6db6a8c278aae8b210543
parenta6cd03ae90df8ed8de8fd53c6e408a3f8d1ca077 (diff)
downloadsssd_unused-24b333a01aec29cd0fbe3042f362d5bbeec6b99b.tar.gz
sssd_unused-24b333a01aec29cd0fbe3042f362d5bbeec6b99b.tar.xz
sssd_unused-24b333a01aec29cd0fbe3042f362d5bbeec6b99b.zip
NSS: Expire in-memory netgroup cache before the nowait timeout
The fact that we were keeping it in memory for the full duration of the cache timeout meant that we would never reap the benefits of the midpoint cache refresh. https://fedorahosted.org/sssd/ticket/1340
-rw-r--r--src/responder/nss/nsssrv_netgroup.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/responder/nss/nsssrv_netgroup.c b/src/responder/nss/nsssrv_netgroup.c
index 0c3ca592..151ded23 100644
--- a/src/responder/nss/nsssrv_netgroup.c
+++ b/src/responder/nss/nsssrv_netgroup.c
@@ -387,6 +387,7 @@ static errno_t lookup_netgr_step(struct setent_step_ctx *step_ctx)
struct getent_ctx *netgr;
struct sysdb_ctx *sysdb;
char *name = NULL;
+ uint32_t lifetime;
/* Check each domain for this netgroup name */
while (dom) {
@@ -502,7 +503,14 @@ static errno_t lookup_netgr_step(struct setent_step_ctx *step_ctx)
name, dom->name));
netgr->ready = true;
netgr->found = true;
- set_netgr_lifetime(dom->netgroup_timeout, step_ctx, netgr);
+ if (step_ctx->nctx->cache_refresh_percent) {
+ lifetime = dom->netgroup_timeout *
+ (step_ctx->nctx->cache_refresh_percent / 100);
+ } else {
+ lifetime = dom->netgroup_timeout;
+ }
+ if (lifetime < 10) lifetime = 10;
+ set_netgr_lifetime(lifetime, step_ctx, netgr);
return EOK;
}