From 0d19785f9ffd9c66df5b30d208ec7b0216a9555b Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Sun, 29 Mar 2015 16:30:27 +0200 Subject: ncache: Add sss_ncache_reset_repopulate_permanent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This new function resets the negative cache and then re-adds the permanent entries. Reviewed-by: Lukáš Slebodník --- src/responder/common/negcache.c | 14 ++++++++++++++ src/responder/common/negcache.h | 6 ++++++ 2 files changed, 20 insertions(+) (limited to 'src/responder/common') diff --git a/src/responder/common/negcache.c b/src/responder/common/negcache.c index 3e58c3e7f..2fa61af53 100644 --- a/src/responder/common/negcache.c +++ b/src/responder/common/negcache.c @@ -838,3 +838,17 @@ done: talloc_free(tmpctx); return ret; } + +/* Reset permanent negcache after checking the domains */ +errno_t sss_ncache_reset_repopulate_permanent(struct resp_ctx *rctx, + struct sss_nc_ctx *ncache) +{ + int ret; + + ret = sss_ncache_reset_permanent(ncache); + if (ret == EOK) { + ret = sss_ncache_prepopulate(ncache, rctx->cdb, rctx); + } + + return ret; +} diff --git a/src/responder/common/negcache.h b/src/responder/common/negcache.h index 00f979dbb..b96fbfda5 100644 --- a/src/responder/common/negcache.h +++ b/src/responder/common/negcache.h @@ -69,6 +69,8 @@ int sss_ncache_set_service_port(struct sss_nc_ctx *ctx, bool permanent, int sss_ncache_reset_permanent(struct sss_nc_ctx *ctx); +struct resp_ctx; + /* Set up the negative cache with values from filter_users and * filter_groups in the sssd.conf */ @@ -76,4 +78,8 @@ errno_t sss_ncache_prepopulate(struct sss_nc_ctx *ncache, struct confdb_ctx *cdb, struct resp_ctx *rctx); +/* Flush the negcache and then repopulate */ +errno_t sss_ncache_reset_repopulate_permanent(struct resp_ctx *rctx, + struct sss_nc_ctx *ncache); + #endif /* _NSS_NEG_CACHE_H_ */ -- cgit