diff options
author | Jan Zeleny <jzeleny@redhat.com> | 2012-05-31 18:08:46 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-06-10 15:45:42 -0400 |
commit | e9f08ebaba5ec61af74c112f50c7d66257998c97 (patch) | |
tree | 947eab8080ae903f8d0261f205a7a7896196223f /src/responder | |
parent | 84c611c1b7c04cc7735ab54d4e5f48284b79e6fb (diff) | |
download | sssd-e9f08ebaba5ec61af74c112f50c7d66257998c97.tar.gz sssd-e9f08ebaba5ec61af74c112f50c7d66257998c97.tar.bz2 sssd-e9f08ebaba5ec61af74c112f50c7d66257998c97.zip |
Allow fast memcache timeout to be configurable
https://fedorahosted.org/sssd/ticket/1318
Diffstat (limited to 'src/responder')
-rw-r--r-- | src/responder/nss/nsssrv.c | 14 | ||||
-rw-r--r-- | src/responder/nss/nsssrv_mmap_cache.c | 4 | ||||
-rw-r--r-- | src/responder/nss/nsssrv_mmap_cache.h | 2 |
3 files changed, 15 insertions, 5 deletions
diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c index 9cb4a569..85bf6dc8 100644 --- a/src/responder/nss/nsssrv.c +++ b/src/responder/nss/nsssrv.c @@ -262,6 +262,7 @@ int nss_process_init(TALLOC_CTX *mem_ctx, struct sss_cmd_table *nss_cmds; struct be_conn *iter; struct nss_ctx *nctx; + int memcache_timeout; int ret, max_retries; int hret; int fd_limit; @@ -323,16 +324,25 @@ int nss_process_init(TALLOC_CTX *mem_ctx, } /* create mmap caches */ + ret = confdb_get_int(nctx->rctx->cdb, + CONFDB_NSS_CONF_ENTRY, + CONFDB_MEMCACHE_TIMEOUT, + 300, &memcache_timeout); + if (ret != EOK) { + DEBUG(0, ("Failed to set up automatic reconnection\n")); + return ret; + } + /* TODO: read cache sizes from configuration */ ret = sss_mmap_cache_init(nctx, "passwd", SSS_MC_PASSWD, - 50000, + 50000, (time_t)memcache_timeout, &nctx->pwd_mc_ctx); if (ret) { DEBUG(SSSDBG_CRIT_FAILURE, ("passwd mmap cache is DISABLED")); } ret = sss_mmap_cache_init(nctx, "group", SSS_MC_GROUP, - 50000, + 50000, (time_t)memcache_timeout, &nctx->grp_mc_ctx); if (ret) { DEBUG(SSSDBG_CRIT_FAILURE, ("group mmap cache is DISABLED")); diff --git a/src/responder/nss/nsssrv_mmap_cache.c b/src/responder/nss/nsssrv_mmap_cache.c index e60d0619..07498a9b 100644 --- a/src/responder/nss/nsssrv_mmap_cache.c +++ b/src/responder/nss/nsssrv_mmap_cache.c @@ -602,7 +602,7 @@ static void sss_mc_header_update(struct sss_mc_ctx *mc_ctx, int status) errno_t sss_mmap_cache_init(TALLOC_CTX *mem_ctx, const char *name, enum sss_mc_type type, size_t n_elem, - struct sss_mc_ctx **mcc) + time_t timeout, struct sss_mc_ctx **mcc) { struct sss_mc_ctx *mc_ctx = NULL; unsigned int rseed; @@ -634,7 +634,7 @@ errno_t sss_mmap_cache_init(TALLOC_CTX *mem_ctx, const char *name, mc_ctx->type = type; - mc_ctx->valid_time_slot = 300; /* 5 min. FIXME: parametrize */ + mc_ctx->valid_time_slot = timeout; mc_ctx->file = talloc_asprintf(mc_ctx, "%s/%s", SSS_NSS_MCACHE_DIR, name); diff --git a/src/responder/nss/nsssrv_mmap_cache.h b/src/responder/nss/nsssrv_mmap_cache.h index 72fcf220..81241b24 100644 --- a/src/responder/nss/nsssrv_mmap_cache.h +++ b/src/responder/nss/nsssrv_mmap_cache.h @@ -32,7 +32,7 @@ enum sss_mc_type { errno_t sss_mmap_cache_init(TALLOC_CTX *mem_ctx, const char *name, enum sss_mc_type type, size_t n_elem, - struct sss_mc_ctx **mcc); + time_t valid_time, struct sss_mc_ctx **mcc); errno_t sss_mmap_cache_pw_store(struct sss_mc_ctx *mcc, struct sized_string *name, |