|
|
ced1f5 |
From 102ea8cf91207d3dc05537d5c558d98e4756027a Mon Sep 17 00:00:00 2001
|
|
|
ced1f5 |
From: Sumit Bose <sbose@redhat.com>
|
|
|
ced1f5 |
Date: Mon, 23 Oct 2017 18:26:55 +0200
|
|
|
ced1f5 |
Subject: [PATCH 26/31] CACHE_REQ: Add cache_req_data_set_bypass_dp()
|
|
|
ced1f5 |
|
|
|
ced1f5 |
Similar to cache_req_data_set_bypass_cache()
|
|
|
ced1f5 |
cache_req_data_set_bypass_dp() can be used to control how the cache_req
|
|
|
ced1f5 |
framework performs the lookup. If cache_req_data_set_bypass_dp() is used
|
|
|
ced1f5 |
with 'true' only a cache lookup is performed and no request is send to
|
|
|
ced1f5 |
the backend even if no entry was found.
|
|
|
ced1f5 |
|
|
|
ced1f5 |
Related to https://pagure.io/SSSD/sssd/issue/2478
|
|
|
ced1f5 |
|
|
|
ced1f5 |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
ced1f5 |
(cherry picked from commit 52e675ec4b160720515c81ae8c0e5a95feb50c57)
|
|
|
ced1f5 |
---
|
|
|
ced1f5 |
src/responder/common/cache_req/cache_req.c | 15 +++++++++++++++
|
|
|
ced1f5 |
src/responder/common/cache_req/cache_req.h | 3 +++
|
|
|
ced1f5 |
src/responder/common/cache_req/cache_req_data.c | 12 ++++++++++++
|
|
|
ced1f5 |
src/responder/common/cache_req/cache_req_private.h | 2 ++
|
|
|
ced1f5 |
4 files changed, 32 insertions(+)
|
|
|
ced1f5 |
|
|
|
ced1f5 |
diff --git a/src/responder/common/cache_req/cache_req.c b/src/responder/common/cache_req/cache_req.c
|
|
|
ced1f5 |
index 5fed7a2ab8beded2fee91f679a12f9a0ff6013ec..110df561101be538e3f0496addfa2e14e42ea918 100644
|
|
|
ced1f5 |
--- a/src/responder/common/cache_req/cache_req.c
|
|
|
ced1f5 |
+++ b/src/responder/common/cache_req/cache_req.c
|
|
|
ced1f5 |
@@ -142,6 +142,13 @@ cache_req_create(TALLOC_CTX *mem_ctx,
|
|
|
ced1f5 |
|
|
|
ced1f5 |
cr->cache_first = rctx->cache_first;
|
|
|
ced1f5 |
cr->bypass_cache = cr->plugin->bypass_cache || cr->data->bypass_cache;
|
|
|
ced1f5 |
+ cr->bypass_dp = cr->data->bypass_dp;
|
|
|
ced1f5 |
+ if (cr->bypass_cache && cr->bypass_dp) {
|
|
|
ced1f5 |
+ CACHE_REQ_DEBUG(SSSDBG_CRIT_FAILURE, cr,
|
|
|
ced1f5 |
+ "Cannot bypass cache and dp at the same time!");
|
|
|
ced1f5 |
+ talloc_free(cr);
|
|
|
ced1f5 |
+ return NULL;
|
|
|
ced1f5 |
+ }
|
|
|
ced1f5 |
|
|
|
ced1f5 |
return cr;
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
@@ -661,6 +668,14 @@ static bool cache_req_search_schema(struct cache_req *cr,
|
|
|
ced1f5 |
if (!first_iteration) {
|
|
|
ced1f5 |
return false;
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
+ } else if (cr->bypass_dp) {
|
|
|
ced1f5 |
+ /* The caller wants to lookup only in the cache */
|
|
|
ced1f5 |
+ bypass_cache = false;
|
|
|
ced1f5 |
+ bypass_dp = true;
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+ if (!first_iteration) {
|
|
|
ced1f5 |
+ return false;
|
|
|
ced1f5 |
+ }
|
|
|
ced1f5 |
} else if (input_domain != NULL) {
|
|
|
ced1f5 |
/* We will search only one domain. */
|
|
|
ced1f5 |
bypass_cache = false;
|
|
|
ced1f5 |
diff --git a/src/responder/common/cache_req/cache_req.h b/src/responder/common/cache_req/cache_req.h
|
|
|
ced1f5 |
index c04b2fba6f0445dcfcc9cfe1b5963ac975c39118..2c88853887fc816bba2182d9d9beaa32fa384158 100644
|
|
|
ced1f5 |
--- a/src/responder/common/cache_req/cache_req.h
|
|
|
ced1f5 |
+++ b/src/responder/common/cache_req/cache_req.h
|
|
|
ced1f5 |
@@ -127,6 +127,9 @@ void
|
|
|
ced1f5 |
cache_req_data_set_bypass_cache(struct cache_req_data *data,
|
|
|
ced1f5 |
bool bypass_cache);
|
|
|
ced1f5 |
|
|
|
ced1f5 |
+void
|
|
|
ced1f5 |
+cache_req_data_set_bypass_dp(struct cache_req_data *data,
|
|
|
ced1f5 |
+ bool bypass_dp);
|
|
|
ced1f5 |
/* Output data. */
|
|
|
ced1f5 |
|
|
|
ced1f5 |
struct cache_req_result {
|
|
|
ced1f5 |
diff --git a/src/responder/common/cache_req/cache_req_data.c b/src/responder/common/cache_req/cache_req_data.c
|
|
|
ced1f5 |
index 48264a321dc603f9708ba71c44542363b11a71ba..ed378274a9a0a68ede8ac99805f3ea4a041382e6 100644
|
|
|
ced1f5 |
--- a/src/responder/common/cache_req/cache_req_data.c
|
|
|
ced1f5 |
+++ b/src/responder/common/cache_req/cache_req_data.c
|
|
|
ced1f5 |
@@ -365,3 +365,15 @@ cache_req_data_set_bypass_cache(struct cache_req_data *data,
|
|
|
ced1f5 |
|
|
|
ced1f5 |
data->bypass_cache = bypass_cache;
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+void
|
|
|
ced1f5 |
+cache_req_data_set_bypass_dp(struct cache_req_data *data,
|
|
|
ced1f5 |
+ bool bypass_dp)
|
|
|
ced1f5 |
+{
|
|
|
ced1f5 |
+ if (data == NULL) {
|
|
|
ced1f5 |
+ DEBUG(SSSDBG_CRIT_FAILURE, "cache_req_data should never be NULL\n");
|
|
|
ced1f5 |
+ return;
|
|
|
ced1f5 |
+ }
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+ data->bypass_dp = bypass_dp;
|
|
|
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 9b706ff7d678f543effb77089857a7e8a42a9c51..0f630542d38a277d1819063fa4134bd7d2525c90 100644
|
|
|
ced1f5 |
--- a/src/responder/common/cache_req/cache_req_private.h
|
|
|
ced1f5 |
+++ b/src/responder/common/cache_req/cache_req_private.h
|
|
|
ced1f5 |
@@ -42,6 +42,7 @@ struct cache_req {
|
|
|
ced1f5 |
struct sss_domain_info *domain;
|
|
|
ced1f5 |
bool cache_first;
|
|
|
ced1f5 |
bool bypass_cache;
|
|
|
ced1f5 |
+ bool bypass_dp;
|
|
|
ced1f5 |
/* Only contact domains with this type */
|
|
|
ced1f5 |
enum cache_req_dom_type req_dom_type;
|
|
|
ced1f5 |
|
|
|
ced1f5 |
@@ -90,6 +91,7 @@ struct cache_req_data {
|
|
|
ced1f5 |
} svc;
|
|
|
ced1f5 |
|
|
|
ced1f5 |
bool bypass_cache;
|
|
|
ced1f5 |
+ bool bypass_dp;
|
|
|
ced1f5 |
};
|
|
|
ced1f5 |
|
|
|
ced1f5 |
struct tevent_req *
|
|
|
ced1f5 |
--
|
|
|
ced1f5 |
2.13.6
|
|
|
ced1f5 |
|