diff options
author | Lukas Slebodnik <lslebodn@redhat.com> | 2013-07-29 15:24:34 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-08-08 00:38:31 +0200 |
commit | db440b3ba6b848010cf2a1fe9f76db394ce860da (patch) | |
tree | b0ff5035e0bde88366c2b96bf87a5d3c60e52483 /src/responder/nss/nsssrv_netgroup.c | |
parent | ada4d12f2e625ad553c6944b7d84bff144c31398 (diff) | |
download | sssd-db440b3ba6b848010cf2a1fe9f76db394ce860da.tar.gz sssd-db440b3ba6b848010cf2a1fe9f76db394ce860da.tar.bz2 sssd-db440b3ba6b848010cf2a1fe9f76db394ce860da.zip |
NSS: Clear cached netgroups if a request comes in from the sss_cache
In order for sss_cache to work correctly, we must also signal the nss
responder to invalidate the hash table requests.
https://fedorahosted.org/sssd/ticket/1759
Diffstat (limited to 'src/responder/nss/nsssrv_netgroup.c')
-rw-r--r-- | src/responder/nss/nsssrv_netgroup.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/responder/nss/nsssrv_netgroup.c b/src/responder/nss/nsssrv_netgroup.c index e1d3a052..a1c41968 100644 --- a/src/responder/nss/nsssrv_netgroup.c +++ b/src/responder/nss/nsssrv_netgroup.c @@ -1031,3 +1031,33 @@ netgroup_hash_delete_cb(hash_entry_t *item, * table */ netgr->lookup_table = NULL; } + +errno_t nss_orphan_netgroups(struct nss_ctx *nctx) +{ + int hret; + unsigned long mcount; + unsigned long i; + hash_key_t *netgroups; + + if (!nctx || !nctx->netgroups) { + return EINVAL; + } + + hret = hash_keys(nctx->netgroups, &mcount, &netgroups); + if (hret != HASH_SUCCESS) { + return EIO; + } + + DEBUG(SSSDBG_TRACE_FUNC, ("Removing netgroups from memory cache.\n")); + + for (i = 0; i < mcount; i++) { + /* netgroup entry will be deleted by setnetgrent_result_timeout */ + hret = hash_delete(nctx->netgroups, &netgroups[i]); + if (hret != HASH_SUCCESS) { + DEBUG(SSSDBG_MINOR_FAILURE, ("Could not delete key from hash\n")); + continue; + } + } + + return EOK; +} |