>From 92318b5cf7c8192bef628a2bbe202b7bfb7fde45 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 18 Sep 2013 15:49:46 +0200 Subject: [PATCH 2/2] NSS: Failure to store entry negative cache should not be fatal The only effect the failure to store a result to negative cache might have would be a slower lookup next time. --- src/responder/nss/nsssrv_cmd.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c index 5b9e71eeb4b04aef5664123d817fb248476d6da8..21e48bd324c9dccb69c464d34263e0d98ad6b2e4 100644 --- a/src/responder/nss/nsssrv_cmd.c +++ b/src/responder/nss/nsssrv_cmd.c @@ -773,7 +773,8 @@ static int nss_cmd_getpwnam_search(struct nss_dom_ctx *dctx) /* set negative cache only if not result of cache check */ ret = sss_ncache_set_user(nctx->ncache, false, dom, name); if (ret != EOK) { - return ret; + DEBUG(SSSDBG_MINOR_FAILURE, + ("Cannot set negative cache for %s@%s\n", dom, name)); } /* if a multidomain search, try with next */ @@ -1303,7 +1304,9 @@ done: /* set negative cache only if not result of cache check */ ret = sss_ncache_set_uid(nctx->ncache, false, cmdctx->id); if (ret != EOK) { - return ret; + /* This should not be fatal, we'll just hit the DP next time */ + DEBUG(SSSDBG_MINOR_FAILURE, + ("Cannot set negative cache for UID %d\n", cmdctx->id)); } DEBUG(SSSDBG_MINOR_FAILURE, ("No matching domain found for [%d]\n", cmdctx->id)); @@ -2583,7 +2586,8 @@ static int nss_cmd_getgrnam_search(struct nss_dom_ctx *dctx) /* set negative cache only if not result of cache check */ ret = sss_ncache_set_group(nctx->ncache, false, dom, name); if (ret != EOK) { - return ret; + DEBUG(SSSDBG_MINOR_FAILURE, + ("Cannot set negative cache for %s@%s\n", dom, name)); } /* if a multidomain search, try with next */ @@ -2735,7 +2739,8 @@ done: /* set negative cache only if not result of cache check */ ret = sss_ncache_set_gid(nctx->ncache, false, cmdctx->id); if (ret != EOK) { - return ret; + DEBUG(SSSDBG_MINOR_FAILURE, + ("Cannot set negative cache for GID %d\n", cmdctx->id)); } DEBUG(SSSDBG_MINOR_FAILURE, ("No matching domain found for [%d]\n", cmdctx->id)); @@ -3561,7 +3566,8 @@ static int nss_cmd_initgroups_search(struct nss_dom_ctx *dctx) /* set negative cache only if not result of cache check */ ret = sss_ncache_set_user(nctx->ncache, false, dom, name); if (ret != EOK) { - return ret; + DEBUG(SSSDBG_MINOR_FAILURE, + ("Cannot set negative cache for %s@%s\n", dom, name)); } /* if a multidomain search, try with next */ @@ -3791,12 +3797,14 @@ static errno_t nss_cmd_getsidby_search(struct nss_dom_ctx *dctx) if (cmdctx->cmd == SSS_NSS_GETSIDBYNAME) { ret = sss_ncache_set_user(nctx->ncache, false, dom, name); if (ret != EOK) { - return ret; + DEBUG(SSSDBG_MINOR_FAILURE, + ("Cannot set negative cache for %s@%s\n", dom, name)); } ret = sss_ncache_set_group(nctx->ncache, false, dom, name); if (ret != EOK) { - return ret; + DEBUG(SSSDBG_MINOR_FAILURE, + ("Cannot set negative cache for %s@%s\n", dom, name)); } } /* if a multidomain search, try with next */ @@ -3857,12 +3865,14 @@ done: ("No matching domain found for [%d], fail!\n", cmdctx->id)); ret = sss_ncache_set_uid(nctx->ncache, false, cmdctx->id); if (ret != EOK) { - return ret; + DEBUG(SSSDBG_MINOR_FAILURE, + ("Cannot set negative cache for UID %d\n", cmdctx->id)); } ret = sss_ncache_set_gid(nctx->ncache, false, cmdctx->id); if (ret != EOK) { - return ret; + DEBUG(SSSDBG_MINOR_FAILURE, + ("Cannot set negative cache for GID %d\n", cmdctx->id)); } } else { DEBUG(SSSDBG_MINOR_FAILURE, @@ -3911,7 +3921,8 @@ static errno_t nss_cmd_getbysid_search(struct nss_dom_ctx *dctx) /* set negative cache only if not result of cache check */ ret = sss_ncache_set_sid(nctx->ncache, false, cmdctx->secid); if (ret != EOK) { - return ret; + DEBUG(SSSDBG_MINOR_FAILURE, + ("Cannot set negative cache for %s\n", cmdctx->secid)); } return ENOENT; -- 1.8.3.1