|
|
bac598 |
From 0c6924b8d474daf35ee30d74e5496957e503b206 Mon Sep 17 00:00:00 2001
|
|
|
bac598 |
From: Alexey Tikhonov <atikhono@redhat.com>
|
|
|
bac598 |
Date: Wed, 20 Jan 2021 15:40:34 +0100
|
|
|
bac598 |
Subject: [PATCH] SBUS: set sbus_name before dp_init_send()
|
|
|
bac598 |
MIME-Version: 1.0
|
|
|
bac598 |
Content-Type: text/plain; charset=UTF-8
|
|
|
bac598 |
Content-Transfer-Encoding: 8bit
|
|
|
bac598 |
|
|
|
bac598 |
Some async task might access sbus_name before dp_initialized() was executed
|
|
|
bac598 |
|
|
|
bac598 |
Resolves: https://github.com/SSSD/sssd/issues/5466
|
|
|
bac598 |
|
|
|
bac598 |
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
|
|
|
bac598 |
---
|
|
|
bac598 |
src/providers/data_provider/dp.c | 21 ++++-----------------
|
|
|
bac598 |
src/providers/data_provider/dp.h | 6 +++---
|
|
|
bac598 |
src/providers/data_provider_be.c | 12 ++++++++++--
|
|
|
bac598 |
3 files changed, 17 insertions(+), 22 deletions(-)
|
|
|
bac598 |
|
|
|
bac598 |
diff --git a/src/providers/data_provider/dp.c b/src/providers/data_provider/dp.c
|
|
|
bac598 |
index 90324d74d..64fe847b2 100644
|
|
|
bac598 |
--- a/src/providers/data_provider/dp.c
|
|
|
bac598 |
+++ b/src/providers/data_provider/dp.c
|
|
|
bac598 |
@@ -134,7 +134,6 @@ static int dp_destructor(struct data_provider *provider)
|
|
|
bac598 |
struct dp_init_state {
|
|
|
bac598 |
struct be_ctx *be_ctx;
|
|
|
bac598 |
struct data_provider *provider;
|
|
|
bac598 |
- char *sbus_name;
|
|
|
bac598 |
};
|
|
|
bac598 |
|
|
|
bac598 |
static void dp_init_done(struct tevent_req *subreq);
|
|
|
bac598 |
@@ -144,7 +143,8 @@ dp_init_send(TALLOC_CTX *mem_ctx,
|
|
|
bac598 |
struct tevent_context *ev,
|
|
|
bac598 |
struct be_ctx *be_ctx,
|
|
|
bac598 |
uid_t uid,
|
|
|
bac598 |
- gid_t gid)
|
|
|
bac598 |
+ gid_t gid,
|
|
|
bac598 |
+ const char *sbus_name)
|
|
|
bac598 |
{
|
|
|
bac598 |
struct dp_init_state *state;
|
|
|
bac598 |
struct tevent_req *subreq;
|
|
|
bac598 |
@@ -177,13 +177,6 @@ dp_init_send(TALLOC_CTX *mem_ctx,
|
|
|
bac598 |
state->provider->gid = gid;
|
|
|
bac598 |
state->provider->be_ctx = be_ctx;
|
|
|
bac598 |
|
|
|
bac598 |
- state->sbus_name = sss_iface_domain_bus(state, be_ctx->domain);
|
|
|
bac598 |
- if (state->sbus_name == NULL) {
|
|
|
bac598 |
- DEBUG(SSSDBG_FATAL_FAILURE, "Could not get sbus backend name.\n");
|
|
|
bac598 |
- ret = ENOMEM;
|
|
|
bac598 |
- goto done;
|
|
|
bac598 |
- }
|
|
|
bac598 |
-
|
|
|
bac598 |
/* Initialize data provider bus. Data provider can receive client
|
|
|
bac598 |
* registration and other D-Bus methods. However no data provider
|
|
|
bac598 |
* request will be executed as long as the modules and targets
|
|
|
bac598 |
@@ -192,7 +185,7 @@ dp_init_send(TALLOC_CTX *mem_ctx,
|
|
|
bac598 |
talloc_set_destructor(state->provider, dp_destructor);
|
|
|
bac598 |
|
|
|
bac598 |
subreq = sbus_server_create_and_connect_send(state->provider, ev,
|
|
|
bac598 |
- state->sbus_name, NULL, sbus_address, true, 1000, uid, gid,
|
|
|
bac598 |
+ sbus_name, NULL, sbus_address, true, 1000, uid, gid,
|
|
|
bac598 |
(sbus_server_on_connection_cb)dp_client_init,
|
|
|
bac598 |
(sbus_server_on_connection_data)state->provider);
|
|
|
bac598 |
if (subreq == NULL) {
|
|
|
bac598 |
@@ -270,16 +263,10 @@ done:
|
|
|
bac598 |
}
|
|
|
bac598 |
|
|
|
bac598 |
errno_t dp_init_recv(TALLOC_CTX *mem_ctx,
|
|
|
bac598 |
- struct tevent_req *req,
|
|
|
bac598 |
- const char **_sbus_name)
|
|
|
bac598 |
+ struct tevent_req *req)
|
|
|
bac598 |
{
|
|
|
bac598 |
- struct dp_init_state *state;
|
|
|
bac598 |
- state = tevent_req_data(req, struct dp_init_state);
|
|
|
bac598 |
-
|
|
|
bac598 |
TEVENT_REQ_RETURN_ON_ERROR(req);
|
|
|
bac598 |
|
|
|
bac598 |
- *_sbus_name = talloc_steal(mem_ctx, state->sbus_name);
|
|
|
bac598 |
-
|
|
|
bac598 |
return EOK;
|
|
|
bac598 |
}
|
|
|
bac598 |
|
|
|
bac598 |
diff --git a/src/providers/data_provider/dp.h b/src/providers/data_provider/dp.h
|
|
|
bac598 |
index a8b6e9f3a..95c6588ad 100644
|
|
|
bac598 |
--- a/src/providers/data_provider/dp.h
|
|
|
bac598 |
+++ b/src/providers/data_provider/dp.h
|
|
|
bac598 |
@@ -122,11 +122,11 @@ dp_init_send(TALLOC_CTX *mem_ctx,
|
|
|
bac598 |
struct tevent_context *ev,
|
|
|
bac598 |
struct be_ctx *be_ctx,
|
|
|
bac598 |
uid_t uid,
|
|
|
bac598 |
- gid_t gid);
|
|
|
bac598 |
+ gid_t gid,
|
|
|
bac598 |
+ const char *sbus_name);
|
|
|
bac598 |
|
|
|
bac598 |
errno_t dp_init_recv(TALLOC_CTX *mem_ctx,
|
|
|
bac598 |
- struct tevent_req *req,
|
|
|
bac598 |
- const char **_sbus_name);
|
|
|
bac598 |
+ struct tevent_req *req);
|
|
|
bac598 |
|
|
|
bac598 |
bool _dp_target_enabled(struct data_provider *provider,
|
|
|
bac598 |
const char *module_name,
|
|
|
bac598 |
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c
|
|
|
bac598 |
index f059a3f96..8458146ea 100644
|
|
|
bac598 |
--- a/src/providers/data_provider_be.c
|
|
|
bac598 |
+++ b/src/providers/data_provider_be.c
|
|
|
bac598 |
@@ -565,7 +565,15 @@ errno_t be_process_init(TALLOC_CTX *mem_ctx,
|
|
|
bac598 |
goto done;
|
|
|
bac598 |
}
|
|
|
bac598 |
|
|
|
bac598 |
- req = dp_init_send(be_ctx, be_ctx->ev, be_ctx, be_ctx->uid, be_ctx->gid);
|
|
|
bac598 |
+ be_ctx->sbus_name = sss_iface_domain_bus(be_ctx, be_ctx->domain);
|
|
|
bac598 |
+ if (be_ctx->sbus_name == NULL) {
|
|
|
bac598 |
+ DEBUG(SSSDBG_FATAL_FAILURE, "Could not get sbus backend name.\n");
|
|
|
bac598 |
+ ret = ENOMEM;
|
|
|
bac598 |
+ goto done;
|
|
|
bac598 |
+ }
|
|
|
bac598 |
+
|
|
|
bac598 |
+ req = dp_init_send(be_ctx, be_ctx->ev, be_ctx, be_ctx->uid, be_ctx->gid,
|
|
|
bac598 |
+ be_ctx->sbus_name);
|
|
|
bac598 |
if (req == NULL) {
|
|
|
bac598 |
ret = ENOMEM;
|
|
|
bac598 |
goto done;
|
|
|
bac598 |
@@ -612,7 +620,7 @@ static void dp_initialized(struct tevent_req *req)
|
|
|
bac598 |
|
|
|
bac598 |
be_ctx = tevent_req_callback_data(req, struct be_ctx);
|
|
|
bac598 |
|
|
|
bac598 |
- ret = dp_init_recv(be_ctx, req, &be_ctx->sbus_name);
|
|
|
bac598 |
+ ret = dp_init_recv(be_ctx, req);
|
|
|
bac598 |
talloc_zfree(req);
|
|
|
bac598 |
if (ret != EOK) {
|
|
|
bac598 |
goto done;
|
|
|
bac598 |
--
|
|
|
bac598 |
2.21.3
|
|
|
bac598 |
|