From 342a8ce31f7acab6793cc53984976dee7182207a Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Fri, 15 Apr 2011 09:27:54 -0400 Subject: Fix regression where nonexistent entries were never added to the negative cache --- src/responder/nss/nsssrv_cmd.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'src/responder/nss/nsssrv_cmd.c') diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c index b897c7cdf..db301b380 100644 --- a/src/responder/nss/nsssrv_cmd.c +++ b/src/responder/nss/nsssrv_cmd.c @@ -565,20 +565,20 @@ static int nss_cmd_getpwnam_search(struct nss_dom_ctx *dctx) } if (dctx->res->count == 0 && !dctx->check_provider) { + /* set negative cache only if not result of cache check */ + ret = sss_ncache_set_user(nctx->ncache, false, dom->name, name); + if (ret != EOK) { + return ret; + } + /* if a multidomain search, try with next */ if (cmdctx->check_next) { dom = dom->next; - continue; + if (dom) continue; } DEBUG(2, ("No results for getpwnam call\n")); - /* set negative cache only if not result of cache check */ - ret = sss_ncache_set_user(nctx->ncache, false, dom->name, name); - if (ret != EOK) { - return ret; - } - return ENOENT; } @@ -1832,20 +1832,20 @@ static int nss_cmd_getgrnam_search(struct nss_dom_ctx *dctx) } if (dctx->res->count == 0 && !dctx->check_provider) { + /* set negative cache only if not result of cache check */ + ret = sss_ncache_set_group(nctx->ncache, false, dom->name, name); + if (ret != EOK) { + return ret; + } + /* if a multidomain search, try with next */ if (cmdctx->check_next) { dom = dom->next; - continue; + if (dom) continue; } DEBUG(2, ("No results for getgrnam call\n")); - /* set negative cache only if not result of cache check */ - ret = sss_ncache_set_group(nctx->ncache, false, dom->name, name); - if (ret != EOK) { - return ret; - } - return ENOENT; } @@ -2866,20 +2866,20 @@ static int nss_cmd_initgroups_search(struct nss_dom_ctx *dctx) } if (dctx->res->count == 0 && !dctx->check_provider) { + /* set negative cache only if not result of cache check */ + ret = sss_ncache_set_user(nctx->ncache, false, dom->name, name); + if (ret != EOK) { + return ret; + } + /* if a multidomain search, try with next */ if (cmdctx->check_next) { dom = dom->next; - continue; + if (dom) continue; } DEBUG(2, ("No results for initgroups call\n")); - /* set negative cache only if not result of cache check */ - ret = sss_ncache_set_user(nctx->ncache, false, dom->name, name); - if (ret != EOK) { - return ret; - } - return ENOENT; } -- cgit