From dd0c81eb7dc40ea95ffd7141452b0c65c31554ff Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Thu, 4 Aug 2016 17:58:47 +0200 Subject: [PATCH 2/3] NSS: Fix offline resolution of netgroups https://fedorahosted.org/sssd/ticket/3123 If talking to the Data Provider failed, we never re-tried looking into the cache. We should consult the cache on DP failures and return cached results, if possible. --- src/responder/nss/nsssrv_netgroup.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/responder/nss/nsssrv_netgroup.c b/src/responder/nss/nsssrv_netgroup.c index e42976b245952291cd1eb36480138514e3d4ec09..49ef0f5c9b264a6252880a2944e8a1bd38ae0527 100644 --- a/src/responder/nss/nsssrv_netgroup.c +++ b/src/responder/nss/nsssrv_netgroup.c @@ -674,6 +674,15 @@ static void lookup_netgr_dp_callback(uint16_t err_maj, uint32_t err_min, "Error: %u, %u, %s\n" "Will try to return what we have in cache\n", (unsigned int)err_maj, (unsigned int)err_min, err_msg); + + /* Try to fall back to cache */ + ret = lookup_netgr_step(step_ctx); + if (ret == EOK) { + /* We have cached results to return */ + nss_setent_notify_done(dctx->netgr); + return; + } + /* Loop to the next domain if possible */ if (cmdctx->check_next && (dctx->domain = get_next_domain(dctx->domain, 0))) { -- 2.7.4