dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0081-dp-replace-autofs-handler-with-enumerate-method.patch

8d3578
From ca1ee9933b9cdb474cef46bde127eaf85f1861d1 Mon Sep 17 00:00:00 2001
8d3578
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
8d3578
Date: Wed, 28 Aug 2019 12:11:51 +0200
8d3578
Subject: [PATCH 81/90] dp: replace autofs handler with enumerate method
8d3578
MIME-Version: 1.0
8d3578
Content-Type: text/plain; charset=UTF-8
8d3578
Content-Transfer-Encoding: 8bit
8d3578
8d3578
Resolves:
8d3578
https://pagure.io/SSSD/sssd/issue/2607
8d3578
8d3578
Reviewed-by: Tomáš Halman <thalman@redhat.com>
8d3578
---
8d3578
 src/providers/data_provider/dp.h              |  3 +-
8d3578
 .../data_provider/dp_target_autofs.c          |  2 +-
8d3578
 src/providers/ipa/ipa_autofs.c                |  4 +-
8d3578
 src/providers/ldap/ldap_common.h              | 14 +++----
8d3578
 src/providers/ldap/sdap_autofs.c              | 38 +++++++++----------
8d3578
 5 files changed, 31 insertions(+), 30 deletions(-)
8d3578
8d3578
diff --git a/src/providers/data_provider/dp.h b/src/providers/data_provider/dp.h
8d3578
index e8b2f9c8f..8ef4a92ae 100644
8d3578
--- a/src/providers/data_provider/dp.h
8d3578
+++ b/src/providers/data_provider/dp.h
8d3578
@@ -78,7 +78,6 @@ enum dp_methods {
8d3578
     DPM_ACCESS_HANDLER,
8d3578
     DPM_SELINUX_HANDLER,
8d3578
     DPM_SUDO_HANDLER,
8d3578
-    DPM_AUTOFS_HANDLER,
8d3578
     DPM_HOSTID_HANDLER,
8d3578
     DPM_DOMAINS_HANDLER,
8d3578
     DPM_SESSION_HANDLER,
8d3578
@@ -86,6 +85,8 @@ enum dp_methods {
8d3578
 
8d3578
     DPM_REFRESH_ACCESS_RULES,
8d3578
 
8d3578
+    DPM_AUTOFS_ENUMERATE,
8d3578
+
8d3578
     DP_METHOD_SENTINEL
8d3578
 };
8d3578
 
8d3578
diff --git a/src/providers/data_provider/dp_target_autofs.c b/src/providers/data_provider/dp_target_autofs.c
8d3578
index 13b12f5dd..5f24f2975 100644
8d3578
--- a/src/providers/data_provider/dp_target_autofs.c
8d3578
+++ b/src/providers/data_provider/dp_target_autofs.c
8d3578
@@ -48,7 +48,7 @@ errno_t dp_autofs_handler(struct sbus_request *sbus_req,
8d3578
     key = mapname;
8d3578
 
8d3578
     dp_req_with_reply(dp_cli, NULL, "AutoFS", key, sbus_req, DPT_AUTOFS,
8d3578
-                      DPM_AUTOFS_HANDLER, dp_flags, data,
8d3578
+                      DPM_AUTOFS_ENUMERATE, dp_flags, data,
8d3578
                       dp_req_reply_std, struct dp_reply_std);
8d3578
 
8d3578
     return EOK;
8d3578
diff --git a/src/providers/ipa/ipa_autofs.c b/src/providers/ipa/ipa_autofs.c
8d3578
index b2e4cbc06..50e30f39f 100644
8d3578
--- a/src/providers/ipa/ipa_autofs.c
8d3578
+++ b/src/providers/ipa/ipa_autofs.c
8d3578
@@ -47,8 +47,8 @@ errno_t ipa_autofs_init(TALLOC_CTX *mem_ctx,
8d3578
         return ret;
8d3578
     }
8d3578
 
8d3578
-    dp_set_method(dp_methods, DPM_AUTOFS_HANDLER,
8d3578
-                  sdap_autofs_handler_send, sdap_autofs_handler_recv, id_ctx->sdap_id_ctx,
8d3578
+    dp_set_method(dp_methods, DPM_AUTOFS_ENUMERATE,
8d3578
+                  sdap_autofs_enumerate_handler_send, sdap_autofs_enumerate_handler_recv, id_ctx,
8d3578
                   struct sdap_id_ctx, struct dp_autofs_data, struct dp_reply_std);
8d3578
 
8d3578
     return ret;
8d3578
diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h
8d3578
index f30b67eb3..85dc6949c 100644
8d3578
--- a/src/providers/ldap/ldap_common.h
8d3578
+++ b/src/providers/ldap/ldap_common.h
8d3578
@@ -156,15 +156,15 @@ sdap_pam_chpass_handler_recv(TALLOC_CTX *mem_ctx,
8d3578
 
8d3578
 /* autofs */
8d3578
 struct tevent_req *
8d3578
-sdap_autofs_handler_send(TALLOC_CTX *mem_ctx,
8d3578
-                         struct sdap_id_ctx *id_ctx,
8d3578
-                         struct dp_autofs_data *data,
8d3578
-                         struct dp_req_params *params);
8d3578
+sdap_autofs_enumerate_handler_send(TALLOC_CTX *mem_ctx,
8d3578
+                                   struct sdap_id_ctx *id_ctx,
8d3578
+                                   struct dp_autofs_data *data,
8d3578
+                                   struct dp_req_params *params);
8d3578
 
8d3578
 errno_t
8d3578
-sdap_autofs_handler_recv(TALLOC_CTX *mem_ctx,
8d3578
-                         struct tevent_req *req,
8d3578
-                         struct dp_reply_std *data);
8d3578
+sdap_autofs_enumerate_handler_recv(TALLOC_CTX *mem_ctx,
8d3578
+                                   struct tevent_req *req,
8d3578
+                                   struct dp_reply_std *data);
8d3578
 
8d3578
 int sdap_service_init(TALLOC_CTX *memctx, struct be_ctx *ctx,
8d3578
                       const char *service_name, const char *dns_service_name,
8d3578
diff --git a/src/providers/ldap/sdap_autofs.c b/src/providers/ldap/sdap_autofs.c
8d3578
index c02c04d5c..f65028d4e 100644
8d3578
--- a/src/providers/ldap/sdap_autofs.c
8d3578
+++ b/src/providers/ldap/sdap_autofs.c
8d3578
@@ -201,26 +201,26 @@ sdap_autofs_get_map_recv(struct tevent_req *req, int *dp_error_out)
8d3578
     return EOK;
8d3578
 }
8d3578
 
8d3578
-struct sdap_autofs_handler_state {
8d3578
+struct sdap_autofs_enumerate_handler_state {
8d3578
     struct dp_reply_std reply;
8d3578
 };
8d3578
 
8d3578
-static void sdap_autofs_handler_done(struct tevent_req *subreq);
8d3578
+static void sdap_autofs_enumerate_handler_done(struct tevent_req *subreq);
8d3578
 
8d3578
 struct tevent_req *
8d3578
-sdap_autofs_handler_send(TALLOC_CTX *mem_ctx,
8d3578
-                         struct sdap_id_ctx *id_ctx,
8d3578
-                         struct dp_autofs_data *data,
8d3578
-                         struct dp_req_params *params)
8d3578
+sdap_autofs_enumerate_handler_send(TALLOC_CTX *mem_ctx,
8d3578
+                                   struct sdap_id_ctx *id_ctx,
8d3578
+                                   struct dp_autofs_data *data,
8d3578
+                                   struct dp_req_params *params)
8d3578
 {
8d3578
-    struct sdap_autofs_handler_state *state;
8d3578
+    struct sdap_autofs_enumerate_handler_state *state;
8d3578
     struct tevent_req *subreq;
8d3578
     struct tevent_req *req;
8d3578
     const char *master_map;
8d3578
 
8d3578
     errno_t ret;
8d3578
 
8d3578
-    req = tevent_req_create(mem_ctx, &state, struct sdap_autofs_handler_state);
8d3578
+    req = tevent_req_create(mem_ctx, &state, struct sdap_autofs_enumerate_handler_state);
8d3578
     if (req == NULL) {
8d3578
         DEBUG(SSSDBG_CRIT_FAILURE, "tevent_req_create() failed\n");
8d3578
         return NULL;
8d3578
@@ -250,7 +250,7 @@ sdap_autofs_handler_send(TALLOC_CTX *mem_ctx,
8d3578
         goto immediately;
8d3578
     }
8d3578
 
8d3578
-    tevent_req_set_callback(subreq, sdap_autofs_handler_done, req);
8d3578
+    tevent_req_set_callback(subreq, sdap_autofs_enumerate_handler_done, req);
8d3578
 
8d3578
     return req;
8d3578
 
8d3578
@@ -264,15 +264,15 @@ immediately:
8d3578
     return req;
8d3578
 }
8d3578
 
8d3578
-static void sdap_autofs_handler_done(struct tevent_req *subreq)
8d3578
+static void sdap_autofs_enumerate_handler_done(struct tevent_req *subreq)
8d3578
 {
8d3578
-    struct sdap_autofs_handler_state *state;
8d3578
+    struct sdap_autofs_enumerate_handler_state *state;
8d3578
     struct tevent_req *req;
8d3578
     int dp_error;
8d3578
     errno_t ret;
8d3578
 
8d3578
     req = tevent_req_callback_data(subreq, struct tevent_req);
8d3578
-    state = tevent_req_data(req, struct sdap_autofs_handler_state);
8d3578
+    state = tevent_req_data(req, struct sdap_autofs_enumerate_handler_state);
8d3578
 
8d3578
     ret = sdap_autofs_get_map_recv(subreq, &dp_error);
8d3578
     talloc_zfree(subreq);
8d3578
@@ -283,13 +283,13 @@ static void sdap_autofs_handler_done(struct tevent_req *subreq)
8d3578
 }
8d3578
 
8d3578
 errno_t
8d3578
-sdap_autofs_handler_recv(TALLOC_CTX *mem_ctx,
8d3578
-                         struct tevent_req *req,
8d3578
-                         struct dp_reply_std *data)
8d3578
+sdap_autofs_enumerate_handler_recv(TALLOC_CTX *mem_ctx,
8d3578
+                                   struct tevent_req *req,
8d3578
+                                   struct dp_reply_std *data)
8d3578
 {
8d3578
-    struct sdap_autofs_handler_state *state = NULL;
8d3578
+    struct sdap_autofs_enumerate_handler_state *state = NULL;
8d3578
 
8d3578
-    state = tevent_req_data(req, struct sdap_autofs_handler_state);
8d3578
+    state = tevent_req_data(req, struct sdap_autofs_enumerate_handler_state);
8d3578
 
8d3578
     TEVENT_REQ_RETURN_ON_ERROR(req);
8d3578
 
8d3578
@@ -313,8 +313,8 @@ errno_t sdap_autofs_init(TALLOC_CTX *mem_ctx,
8d3578
         return ret;
8d3578
     }
8d3578
 
8d3578
-    dp_set_method(dp_methods, DPM_AUTOFS_HANDLER,
8d3578
-                  sdap_autofs_handler_send, sdap_autofs_handler_recv, id_ctx,
8d3578
+    dp_set_method(dp_methods, DPM_AUTOFS_ENUMERATE,
8d3578
+                  sdap_autofs_enumerate_handler_send, sdap_autofs_enumerate_handler_recv, id_ctx,
8d3578
                   struct sdap_id_ctx, struct dp_autofs_data, struct dp_reply_std);
8d3578
 
8d3578
     return EOK;
8d3578
-- 
8d3578
2.20.1
8d3578