summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-01-15 07:05:56 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-01-16 17:09:09 +0100
commit6ef827a32006cc1a92b5c987d1918aa89b04c379 (patch)
treeb8dfec83949f2f4f407c84bbbec31cd431b5b9be
parentf4bb6b0e38fdaa9e0f044a2b125c48745c6b0899 (diff)
downloadsssd-6ef827a32006cc1a92b5c987d1918aa89b04c379.tar.gz
sssd-6ef827a32006cc1a92b5c987d1918aa89b04c379.tar.xz
sssd-6ef827a32006cc1a92b5c987d1918aa89b04c379.zip
NSS: invalidate memcache user entry on initgr, too
https://fedorahosted.org/sssd/ticket/1757 When the user entry was missing completely after initgroups, we would never invalidate the user entry from cache. This led to dangling cache entried in memory cache if the user was removed from the server while still being in memory cache.
-rw-r--r--src/responder/nss/nsssrv_cmd.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 0631bcd9a..0a51fbe89 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -3409,6 +3409,7 @@ void nss_update_initgr_memcache(struct nss_ctx *nctx,
TALLOC_CTX *tmp_ctx = NULL;
struct sss_domain_info *dom;
struct ldb_result *res;
+ struct sized_string delete_name;
bool changed = false;
uint32_t id;
uint32_t gids[gnum];
@@ -3447,6 +3448,16 @@ void nss_update_initgr_memcache(struct nss_ctx *nctx,
memcpy(gids, groups, gnum * sizeof(uint32_t));
if (ret == ENOENT || res->count == 0) {
+ /* The user is gone. Invalidate the mc record */
+ to_sized_string(&delete_name, name);
+ ret = sss_mmap_cache_pw_invalidate(nctx->pwd_mc_ctx, &delete_name);
+ if (ret != EOK && ret != ENOENT) {
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("Internal failure in memory cache code: %d [%s]\n",
+ ret, strerror(ret)));
+ }
+
+ /* Also invalidate his groups */
changed = true;
} else {
/* we skip the first entry, it's the user itself */