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

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