Blame SOURCES/0078-CACHE_REQ-Export-cache_req_search_ncache_add-as-cach.patch

ced1f5
From 26ba3d0b033e52e63d6ec438d7be0df97cb4ce1b Mon Sep 17 00:00:00 2001
ced1f5
From: Jakub Hrozek <jhrozek@redhat.com>
ced1f5
Date: Mon, 30 Oct 2017 20:18:36 +0100
ced1f5
Subject: [PATCH 78/83] CACHE_REQ: Export cache_req_search_ncache_add() as
ced1f5
 cache_req private interface
ced1f5
MIME-Version: 1.0
ced1f5
Content-Type: text/plain; charset=UTF-8
ced1f5
Content-Transfer-Encoding: 8bit
ced1f5
ced1f5
Previously, it was enough to add an entry to the negative cache of the
ced1f5
domain being processed in cache_req (cr->domain). But the locator plugin
ced1f5
can return any domain from the processed domain's subdomain list as
ced1f5
well.
ced1f5
ced1f5
Therefore, this patch extends the internal API for the possibility of
ced1f5
setting the negative cache in another domain as well.
ced1f5
ced1f5
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
ced1f5
Reviewed-by: Sumit Bose <sbose@redhat.com>
ced1f5
(cherry picked from commit 800b1a27543fa83bc6cd73d8e2789f3cdbaf584a)
ced1f5
---
ced1f5
 src/responder/common/cache_req/cache_req_private.h |  3 +++
ced1f5
 src/responder/common/cache_req/cache_req_search.c  | 10 ++++++++--
ced1f5
 2 files changed, 11 insertions(+), 2 deletions(-)
ced1f5
ced1f5
diff --git a/src/responder/common/cache_req/cache_req_private.h b/src/responder/common/cache_req/cache_req_private.h
ced1f5
index 0f630542d38a277d1819063fa4134bd7d2525c90..a156fc65fed80693cdd0473613aeaaa3f5bb2269 100644
ced1f5
--- a/src/responder/common/cache_req/cache_req_private.h
ced1f5
+++ b/src/responder/common/cache_req/cache_req_private.h
ced1f5
@@ -116,6 +116,9 @@ cache_req_steal_data_and_send(TALLOC_CTX *mem_ctx,
ced1f5
                               const char *domain,
ced1f5
                               struct cache_req_data *data);
ced1f5
 
ced1f5
+void cache_req_search_ncache_add_to_domain(struct cache_req *cr,
ced1f5
+                                           struct sss_domain_info *domain);
ced1f5
+
ced1f5
 errno_t
ced1f5
 cache_req_add_result(TALLOC_CTX *mem_ctx,
ced1f5
                      struct cache_req_result *new_result,
ced1f5
diff --git a/src/responder/common/cache_req/cache_req_search.c b/src/responder/common/cache_req/cache_req_search.c
ced1f5
index 56d0345cd8f98de574961d3c9628ae7a4c24f9be..9d5ad8056cda0284b1cc32cd51d7cb0ec12ad667 100644
ced1f5
--- a/src/responder/common/cache_req/cache_req_search.c
ced1f5
+++ b/src/responder/common/cache_req/cache_req_search.c
ced1f5
@@ -60,7 +60,8 @@ static errno_t cache_req_search_ncache(struct cache_req *cr)
ced1f5
     return EOK;
ced1f5
 }
ced1f5
 
ced1f5
-static void cache_req_search_ncache_add(struct cache_req *cr)
ced1f5
+void cache_req_search_ncache_add_to_domain(struct cache_req *cr,
ced1f5
+                                           struct sss_domain_info *domain)
ced1f5
 {
ced1f5
     errno_t ret;
ced1f5
 
ced1f5
@@ -73,7 +74,7 @@ static void cache_req_search_ncache_add(struct cache_req *cr)
ced1f5
     CACHE_REQ_DEBUG(SSSDBG_TRACE_FUNC, cr, "Adding [%s] to negative cache\n",
ced1f5
                     cr->debugobj);
ced1f5
 
ced1f5
-    ret = cr->plugin->ncache_add_fn(cr->ncache, cr->domain, cr->data);
ced1f5
+    ret = cr->plugin->ncache_add_fn(cr->ncache, domain, cr->data);
ced1f5
     if (ret != EOK) {
ced1f5
         CACHE_REQ_DEBUG(SSSDBG_MINOR_FAILURE, cr,
ced1f5
                         "Cannot set negative cache for [%s] [%d]: %s\n",
ced1f5
@@ -84,6 +85,11 @@ static void cache_req_search_ncache_add(struct cache_req *cr)
ced1f5
     return;
ced1f5
 }
ced1f5
 
ced1f5
+static void cache_req_search_ncache_add(struct cache_req *cr)
ced1f5
+{
ced1f5
+    return cache_req_search_ncache_add_to_domain(cr, cr->domain);
ced1f5
+}
ced1f5
+
ced1f5
 static errno_t cache_req_search_ncache_filter(TALLOC_CTX *mem_ctx,
ced1f5
                                               struct cache_req *cr,
ced1f5
                                               struct ldb_result **_result)
ced1f5
-- 
ced1f5
2.14.3
ced1f5