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