Blame SOURCES/0023-cache_req-add-helper-to-call-user-by-upn-search.patch

8ad293
From a3e2677f919c6b1b1649ad80cc3435b4bb2efc0d Mon Sep 17 00:00:00 2001
8ad293
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
8ad293
Date: Thu, 10 Dec 2020 19:28:58 +0100
8ad293
Subject: [PATCH 23/27] cache_req: add helper to call user by upn search
8ad293
8ad293
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
8ad293
Reviewed-by: Sumit Bose <sbose@redhat.com>
8ad293
---
8ad293
 src/responder/common/cache_req/cache_req.h    | 13 +++++++++++
8ad293
 .../cache_req/plugins/cache_req_user_by_upn.c | 23 +++++++++++++++++++
8ad293
 2 files changed, 36 insertions(+)
8ad293
8ad293
diff --git a/src/responder/common/cache_req/cache_req.h b/src/responder/common/cache_req/cache_req.h
8ad293
index d36cb2d3b..d301a076e 100644
8ad293
--- a/src/responder/common/cache_req/cache_req.h
8ad293
+++ b/src/responder/common/cache_req/cache_req.h
8ad293
@@ -277,6 +277,19 @@ cache_req_user_by_name_attrs_send(TALLOC_CTX *mem_ctx,
8ad293
 #define cache_req_user_by_name_attrs_recv(mem_ctx, req, _result) \
8ad293
     cache_req_single_domain_recv(mem_ctx, req, _result)
8ad293
 
8ad293
+struct tevent_req *
8ad293
+cache_req_user_by_upn_send(TALLOC_CTX *mem_ctx,
8ad293
+                           struct tevent_context *ev,
8ad293
+                           struct resp_ctx *rctx,
8ad293
+                           struct sss_nc_ctx *ncache,
8ad293
+                           int cache_refresh_percent,
8ad293
+                           enum cache_req_dom_type req_dom_type,
8ad293
+                           const char *domain,
8ad293
+                           const char *upn);
8ad293
+
8ad293
+#define cache_req_user_by_upn_recv(mem_ctx, req, _result) \
8ad293
+    cache_req_single_domain_recv(mem_ctx, req, _result);
8ad293
+
8ad293
 struct tevent_req *
8ad293
 cache_req_user_by_id_send(TALLOC_CTX *mem_ctx,
8ad293
                           struct tevent_context *ev,
8ad293
diff --git a/src/responder/common/cache_req/plugins/cache_req_user_by_upn.c b/src/responder/common/cache_req/plugins/cache_req_user_by_upn.c
8ad293
index e08ab70ae..037994c8c 100644
8ad293
--- a/src/responder/common/cache_req/plugins/cache_req_user_by_upn.c
8ad293
+++ b/src/responder/common/cache_req/plugins/cache_req_user_by_upn.c
8ad293
@@ -133,3 +133,26 @@ const struct cache_req_plugin cache_req_user_by_upn = {
8ad293
     .dp_get_domain_send_fn = NULL,
8ad293
     .dp_get_domain_recv_fn = NULL,
8ad293
 };
8ad293
+
8ad293
+struct tevent_req *
8ad293
+cache_req_user_by_upn_send(TALLOC_CTX *mem_ctx,
8ad293
+                           struct tevent_context *ev,
8ad293
+                           struct resp_ctx *rctx,
8ad293
+                           struct sss_nc_ctx *ncache,
8ad293
+                           int cache_refresh_percent,
8ad293
+                           enum cache_req_dom_type req_dom_type,
8ad293
+                           const char *domain,
8ad293
+                           const char *upn)
8ad293
+{
8ad293
+    struct cache_req_data *data;
8ad293
+
8ad293
+    data = cache_req_data_name(mem_ctx, CACHE_REQ_USER_BY_UPN, upn);
8ad293
+    if (data == NULL) {
8ad293
+        return NULL;
8ad293
+    }
8ad293
+
8ad293
+    return cache_req_steal_data_and_send(mem_ctx, ev, rctx, ncache,
8ad293
+                                         cache_refresh_percent,
8ad293
+                                         req_dom_type, domain,
8ad293
+                                         data);
8ad293
+}
8ad293
-- 
8ad293
2.21.3
8ad293