diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2011-04-15 09:19:40 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-04-15 12:03:48 -0400 |
commit | d51dfcd1ca28ce1e02299ae42313fb575c485b46 (patch) | |
tree | ffea1f28cb1b7b9c63d47b87302aef7000e01fc6 /src/responder/nss/nsssrv_cmd.c | |
parent | 0de124abf79be1bb9fcfec251b9df8880159817c (diff) | |
download | sssd-d51dfcd1ca28ce1e02299ae42313fb575c485b46.tar.gz sssd-d51dfcd1ca28ce1e02299ae42313fb575c485b46.tar.xz sssd-d51dfcd1ca28ce1e02299ae42313fb575c485b46.zip |
Fix regressions in the negative cachesssd-1.5.1-30.el5
Do not throw a DP error when failing to delete a nonexistent entity
Add debug logging to the negative cache
Fix a regression with the negative cache in multi-domain configurations
Fix regression where nonexistent entries were never added to the negative cache
Diffstat (limited to 'src/responder/nss/nsssrv_cmd.c')
-rw-r--r-- | src/responder/nss/nsssrv_cmd.c | 63 |
1 files changed, 39 insertions, 24 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c index 2153d649c..db301b380 100644 --- a/src/responder/nss/nsssrv_cmd.c +++ b/src/responder/nss/nsssrv_cmd.c @@ -532,12 +532,17 @@ static int nss_cmd_getpwnam_search(struct nss_dom_ctx *dctx) /* if neg cached, return we didn't find it */ if (ret == EEXIST) { - DEBUG(2, ("User [%s] does not exist! (negative cache)\n", name)); + DEBUG(2, ("User [%s] does not exist in [%s]! (negative cache)\n", + name, dom->name)); /* if a multidomain search, try with next */ if (cmdctx->check_next) { dom = dom->next; continue; } + /* There are no further domains or this was a + * fully-qualified user request. + */ + return ENOENT; } DEBUG(4, ("Requesting info for [%s@%s]\n", name, dom->name)); @@ -560,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; } @@ -1794,12 +1799,17 @@ static int nss_cmd_getgrnam_search(struct nss_dom_ctx *dctx) /* if neg cached, return we didn't find it */ if (ret == EEXIST) { - DEBUG(2, ("Group [%s] does not exist! (negative cache)\n", name)); + DEBUG(2, ("Group [%s] does not exist in [%s]! (negative cache)\n", + name, dom->name)); /* if a multidomain search, try with next */ if (cmdctx->check_next) { dom = dom->next; continue; } + /* There are no further domains or this was a + * fully-qualified user request. + */ + return ENOENT; } DEBUG(4, ("Requesting info for [%s@%s]\n", name, dom->name)); @@ -1822,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; } @@ -2827,12 +2837,17 @@ static int nss_cmd_initgroups_search(struct nss_dom_ctx *dctx) /* if neg cached, return we didn't find it */ if (ret == EEXIST) { - DEBUG(2, ("User [%s] does not exist! (negative cache)\n", name)); + DEBUG(2, ("User [%s] does not exist in [%s]! (negative cache)\n", + dom->name, name)); /* if a multidomain search, try with next */ if (cmdctx->check_next) { dom = dom->next; continue; } + /* There are no further domains or this was a + * fully-qualified user request. + */ + return ENOENT; } DEBUG(4, ("Requesting info for [%s@%s]\n", name, dom->name)); @@ -2851,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; } |