From ada4d12f2e625ad553c6944b7d84bff144c31398 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Mon, 29 Jul 2013 14:45:35 +0200 Subject: NSS: allow removing entries from netgroup hash table There is a timed desctructor in the nss responder that, when the entry timeout passes, removes the netgroup from the hash table while the netgroup is freed. This patch adds a hash delete callback so that if the netgroup is removed from the hash table with hash_delete, its hash table pointer will be invalidated. Later, when the entry is being freed, the destructor won't attempt to remove it from the hash table. --- src/responder/nss/nsssrv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/responder/nss/nsssrv.c') diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c index ebad15015..7bc49e3ef 100644 --- a/src/responder/nss/nsssrv.c +++ b/src/responder/nss/nsssrv.c @@ -35,6 +35,7 @@ #include "responder/nss/nsssrv.h" #include "responder/nss/nsssrv_private.h" #include "responder/nss/nsssrv_mmap_cache.h" +#include "responder/nss/nsssrv_netgroup.h" #include "responder/common/negcache.h" #include "db/sysdb.h" #include "confdb/confdb.h" @@ -477,7 +478,8 @@ int nss_process_init(TALLOC_CTX *mem_ctx, } /* Create the lookup table for netgroup results */ - hret = sss_hash_create(nctx, 10, &nctx->netgroups); + hret = sss_hash_create_ex(nctx, 10, &nctx->netgroups, 0, 0, 0, 0, + netgroup_hash_delete_cb, NULL); if (hret != HASH_SUCCESS) { DEBUG(0,("Unable to initialize netgroup hash table\n")); ret = EIO; -- cgit