sssd/0070-NSS-Fix-offline-resolu...

45 lines
1.6 KiB
Diff

From 068aadc5169380c37459c7cb50d397e93d5f121d Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Thu, 4 Aug 2016 17:58:47 +0200
Subject: [PATCH 70/79] NSS: Fix offline resolution of netgroups
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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.
Resolves:
https://fedorahosted.org/sssd/ticket/3123
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
(cherry picked from commit a3108c5cd1ebb05c133c8e8990278ac4f4b8e25c)
---
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.9.3