summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichal Zidek <mzidek@redhat.com>2012-12-13 17:38:55 +0100
committerJakub Hrozek <jhrozek@redhat.com>2012-12-13 20:50:31 +0100
commite61587a5d620310c09f226f43c9bb3008481bbe3 (patch)
tree458ac3965ad63e232cf9270de5075134711d6c09 /src
parente7b5b99e5a5d276f32039c4fb8b21ba51bdb1537 (diff)
downloadsssd-e61587a5d620310c09f226f43c9bb3008481bbe3.tar.gz
sssd-e61587a5d620310c09f226f43c9bb3008481bbe3.tar.bz2
sssd-e61587a5d620310c09f226f43c9bb3008481bbe3.zip
sssd_nss: Remove entries from memory cache if not found in sysdb
Functions nss_cmd_getXXnam remove entries from memory cache if not found in sysdb cache of a local domain.
Diffstat (limited to 'src')
-rw-r--r--src/responder/nss/nsssrv_cmd.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 14bb3afe..c30e21ee 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -660,6 +660,7 @@ static int nss_cmd_getpwnam_search(struct nss_dom_ctx *dctx)
struct sss_domain_info *dom = dctx->domain;
struct cli_ctx *cctx = cmdctx->cctx;
char *name = NULL;
+ struct sized_string delete_usrname;
struct sysdb_ctx *sysdb;
struct nss_ctx *nctx;
int ret;
@@ -744,6 +745,17 @@ static int nss_cmd_getpwnam_search(struct nss_dom_ctx *dctx)
DEBUG(2, ("No results for getpwnam call\n"));
+ /* User not found in ldb -> delete user from memory cache. */
+ to_sized_string(&delete_usrname, name);
+ ret = sss_mmap_cache_pw_invalidate(nctx->pwd_mc_ctx,
+ &delete_usrname);
+ if (ret != EOK && ret != ENOENT) {
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("Internal failure in memory cache code: %d [%s]\n",
+ ret, strerror(ret)));
+ }
+
+
return ENOENT;
}
@@ -2250,6 +2262,7 @@ static int nss_cmd_getgrnam_search(struct nss_dom_ctx *dctx)
struct sss_domain_info *dom = dctx->domain;
struct cli_ctx *cctx = cmdctx->cctx;
char *name = NULL;
+ struct sized_string delete_grpname;
struct sysdb_ctx *sysdb;
struct nss_ctx *nctx;
int ret;
@@ -2334,6 +2347,16 @@ static int nss_cmd_getgrnam_search(struct nss_dom_ctx *dctx)
DEBUG(2, ("No results for getgrnam call\n"));
+ /* Group not found in ldb -> delete group from memory cache. */
+ to_sized_string(&delete_grpname, name);
+ ret = sss_mmap_cache_gr_invalidate(nctx->grp_mc_ctx,
+ &delete_grpname);
+ if (ret != EOK && ret != ENOENT) {
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("Internal failure in memory cache code: %d [%s]\n",
+ ret, strerror(ret)));
+ }
+
return ENOENT;
}